2gis / lode_runner

Patched nosetests test runner for better python testing. Made to run with unittest standard library.
Mozilla Public License 2.0
6 stars 4 forks source link

strange behavior with empty dataprovider #21

Open denkj opened 8 years ago

denkj commented 8 years ago

Example test class:

from unittest import TestCase

import lode_runner

class TestFirst(TestCase):
    @lode_runner.dataprovider([])
    def test_me(self, data):
        assert True

Results:

lode_runner --dataproviders-first test.py

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

nosetests --dataproviders-first test.py
----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

nosetests test.py

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

lode_runner test.py
E
======================================================================
ERROR: Failure: ValueError (no such test method in <class 'test.TestFirst'>: test_me)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/case.py", line 392, in __init__
    testMethod = getattr(self, methodName)
AttributeError: 'TestFirst' object has no attribute 'test_me'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/denis/dev/venvs/sabers-webapi-venv/lib/python3.5/site-packages/lode_runner/plugins/initializer.py", line 18, in wrapper
    result = test(*args, **kwargs)
  File "/home/denis/dev/venvs/sabers-webapi-venv/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/denis/dev/venvs/sabers-webapi-venv/lib/python3.5/site-packages/nose/loader.py", line 523, in makeTest
    return self._makeTest(obj, parent)
  File "/home/denis/dev/venvs/sabers-webapi-venv/lib/python3.5/site-packages/nose/loader.py", line 570, in _makeTest
    return self.loadTestsFromTestCase(obj)
  File "/home/denis/dev/venvs/sabers-webapi-venv/lib/python3.5/site-packages/lode_runner/core.py", line 50, in loadTestsFromTestCase
    return self.suiteClass(list(map(testCaseClass, test_case_names)))
  File "/usr/lib/python3.5/unittest/case.py", line 398, in __init__
    (self.__class__, methodName))
ValueError: no such test method in <class 'test.TestFirst'>: test_me

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)