Commit 628b5278 authored by Jason R. Coombs's avatar Jason R. Coombs

Extract the resolution of loader/runner classes. Allows None value to...

Extract the resolution of loader/runner classes. Allows None value to pass-through to unittest.main. Fixes #180.
parent 9cd58f5b
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
CHANGES CHANGES
======= =======
-----
3.4.1
-----
* Issue #180: Fix regression in test command not caught by py.test-run tests.
--- ---
3.4 3.4
--- ---
......
...@@ -158,12 +158,19 @@ class test(Command): ...@@ -158,12 +158,19 @@ class test(Command):
del_modules.append(name) del_modules.append(name)
list(map(sys.modules.__delitem__, del_modules)) list(map(sys.modules.__delitem__, del_modules))
loader_ep = EntryPoint.parse("x="+self.test_loader)
loader_class = loader_ep.load(require=False)
runner_ep = EntryPoint.parse("x=" + self.test_runner)
runner_class = runner_ep.load(require=False)
unittest.main( unittest.main(
None, None, [unittest.__file__]+self.test_args, None, None, [unittest.__file__]+self.test_args,
testLoader=loader_class(), testLoader=self._resolve_as_ep(self.test_loader),
testRunner=runner_class(), testRunner=self._resolve_as_ep(self.test_runner),
) )
@staticmethod
def _resolve_as_ep(val):
"""
Load the indicated attribute value, called, as a as if it were
specified as an entry point.
"""
if val is None:
return
parsed = EntryPoint.parse("x=" + val)
return parsed.load(require=False)()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment