diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-03-30 17:20:36 +0100 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-03-30 17:20:36 +0100 |
commit | 628b5278a174d94907a25d065403feed1d2cd1d8 (patch) | |
tree | 364ca50a16c00520c666271e4f9dff772574827f /setuptools/command/test.py | |
parent | 9cd58f5b62a43b50bbf01a41a9f6ad18002bcdd1 (diff) | |
download | external_python_setuptools-628b5278a174d94907a25d065403feed1d2cd1d8.tar.gz external_python_setuptools-628b5278a174d94907a25d065403feed1d2cd1d8.tar.bz2 external_python_setuptools-628b5278a174d94907a25d065403feed1d2cd1d8.zip |
Extract the resolution of loader/runner classes. Allows None value to pass-through to unittest.main. Fixes #180.
Diffstat (limited to 'setuptools/command/test.py')
-rw-r--r-- | setuptools/command/test.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/setuptools/command/test.py b/setuptools/command/test.py index c46efc0f..e377a781 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -158,12 +158,19 @@ class test(Command): del_modules.append(name) 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( None, None, [unittest.__file__]+self.test_args, - testLoader=loader_class(), - testRunner=runner_class(), + testLoader=self._resolve_as_ep(self.test_loader), + 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)() |