Skip to content

Commit

Permalink
Merge pull request #11 from launchableinc/revert-10-fix-test-name
Browse files Browse the repository at this point in the history
Revert "Change test_name's formart to file_path#class#func"
  • Loading branch information
ninjinkun authored Oct 26, 2020
2 parents 4db10e7 + 7c1847a commit e70f824
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions launchable/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from nose.plugins import Plugin
from nose.plugins.capture import Capture
from nose.plugins.xunit import Tee
from nose.util import test_address

from launchable.case_event import CaseEvent
from launchable.client import LaunchableClientFactory
Expand Down Expand Up @@ -137,9 +136,11 @@ def _getCapturedStderr(self):

def _addResult(self, test, status, queueing):
def get_test_name(t):
file_path, module, name = test_address(t.test)
# it return such as tests/dir1/test1.py#test1#test_evens
return "#".join([os.path.relpath(file_path), module, name])
if isinstance(t.context, ModuleType):
return t.context.__name__

# context is a class
return t.context.__module__

logger.debug("Adding a test result: test: {}, context: {}".format(test, test.context))
result = CaseEvent(get_test_name(test), self._timeTaken(), status, self._getCapturedStdout(),
Expand Down

0 comments on commit e70f824

Please sign in to comment.