internally make varnames() deal with classes's __init__,

although it's not needed by pytest itself atm.  Also
fix caching.  Fixes issue376.
This commit is contained in:
holger krekel
2013-11-19 15:33:52 +01:00
parent dde0a81677
commit 9b21d3f206
3 changed files with 37 additions and 8 deletions

View File

@@ -438,6 +438,15 @@ def test_varnames():
assert varnames(A().f) == ('y',)
assert varnames(B()) == ('z',)
def test_varnames_class():
class C:
def __init__(self, x):
pass
class D:
pass
assert varnames(C) == ("x",)
assert varnames(D) == ()
class TestMultiCall:
def test_uses_copy_of_methods(self):
l = [lambda: 42]
@@ -654,8 +663,7 @@ def test_default_markers(testdir):
def test_importplugin_issue375(testdir):
testdir.makepyfile(qwe="import aaaa")
with pytest.raises(ImportError) as excinfo:
importplugin("qwe")
excinfo = pytest.raises(ImportError, lambda: importplugin("qwe"))
assert "qwe" not in str(excinfo.value)
assert "aaaa" in str(excinfo.value)