Open luanfonceca opened 2 years ago
Bumping this!
Hey! Would you be able to provide an example of the test case which is causing this failure?
This happens with all tests decorated with parameterized.expand()
because the original method (TestClass.test_method
in this example) is removed and new ones created test_method_0
, test_method_1
.
It was already discussed in https://github.com/wolever/parameterized/issues/37
@wolever As mentioned previously, it's the same issue as #37.
Full example, using unittest
(python v. 3.10
) and parameterized
version 0.9.0
.
import unittest
from parameterized import parameterized
def add_one(num: int) -> int:
return num + 1
class TestAddOne(unittest.TestCase):
@parameterized.expand([
(8, 9),
(0, 1),
(254, 255)
])
def test_add_one(self, num, expected):
self.assertEqual(expected, add_one(num))
When running the whole test suite, the run passes as expected:
Launching unittests with arguments python -m unittest test_example.TestAddOne
Ran 3 tests in 0.001s
OK
As mentioned, the individual test methods are created (Pycharm):
However when executing the singular test method, the run will fail:
Launching unittests with arguments python -m unittest test_example.TestAddOne.test_add_one
File ".../lib/python3.10/unittest/loader.py", line 214, in loadTestsFromName
raise TypeError("don't know how to make test from: %s" % obj)
TypeError: don't know how to make test from: None
Will this be enough as an example? Thanks for having a look.
It does look that this is the same issue as: #37
I just faced that very same issue:
TypeError: don't know how to make test from: None
using Django==3.2.14, Python=3.9.5, and parametrized==0.8.1, note that I'm using the plain unittest with no other libraries like Nosetests, Pytests etc. It's just the regular Django' unittest suite.All the other alternatives to run tests, like the whole test suite, executing just an app, files or even just the Test Class, it works with no issues. Is there any workaround to it? I ask that because this is kind of a blocker for us, thinking on an developer experience POV.
Thanks in advance.