nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

Cannot run individual test when genty_dataset contains colon #1062

Open danflucus opened 6 years ago

danflucus commented 6 years ago

Hi,

I have this genty dataset: _IP_UNMATCHED_DATA = ( ('2001:6:0:0:0:0:0:0'), ('2001:5:0:0:0:0:0:0') )

and this test code: @genty_dataset(*_IP_UNMATCHED_DATA) def test_ipv6(self, ip): assert ip == ip, "Wrong"

When I try to run "test_ipv6" test method with a single input using nose I'm getting the following error:

nosetests regression/test_a.py:TestA.test_ipv6\('2001:6:0:0:0:0:0:0'\)

Traceback (most recent call last): File "/usr/local/bin/nosetests", line 11, in sys.exit(run_exit()) File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 121, in init **extra_args) File "/usr/lib/python2.7/unittest/main.py", line 94, in init self.parseArgs(argv) File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 179, in parseArgs self.createTests() File "/usr/local/lib/python2.7/dist-packages/nose/core.py", line 193, in createTests self.test = self.testLoader.loadTestsFromNames(self.testNames) File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 481, in loadTestsFromNames return unittest.TestLoader.loadTestsFromNames(self, names, module) File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 378, in loadTestsFromName addr = TestAddress(name, workingDir=self.workingDir) File "/usr/local/lib/python2.7/dist-packages/nose/selector.py", line 226, in init self.filename, self.module, self.call = split_test_name(name) File "/usr/local/lib/python2.7/dist-packages/nose/util.py", line 375, in split_test_name file_part, fn = tail.split(':') ValueError: too many values to unpack

Do you know what can I do? Thanks!

danflucus commented 6 years ago

I found this issue while running my test suite with --failed option. So basically this command: nosetests -v --with-xunit --xunit-file=nose_regression_2.xml --failed regression/*.py won't work as expected when datasets used inside the test contains colon.

danflucus commented 6 years ago

I think a similar fix: https://github.com/box/genty/pull/43/files#r43931255 can be applied here also. Not sure though.. Thank you!