Fixed collection of classes with custom `__new__` method

This commit is contained in:
Dmitry Dygalo
2016-07-23 17:37:58 +02:00
parent d37af20527
commit f7ad173fee
4 changed files with 29 additions and 4 deletions

View File

@@ -109,6 +109,18 @@ class TestClass:
colitems = modcol.collect()
assert len(colitems) == 0
def test_issue1579_namedtuple(self, testdir):
testdir.makepyfile("""
import collections
TestCase = collections.namedtuple('TestCase', ['a'])
""")
result = testdir.runpytest('-rw')
result.stdout.fnmatch_lines(
"*cannot collect test class 'TestCase' "
"because it has a __new__ constructor*"
)
class TestGenerator:
def test_generative_functions(self, testdir):