test_source: do not instantiate Source objects during collection

This commit is contained in:
Daniel Hahler 2019-11-07 11:43:59 +01:00
parent 5be3a9b5ce
commit cb21a8db1d
1 changed files with 24 additions and 19 deletions

View File

@ -127,7 +127,8 @@ def test_isparseable():
class TestAccesses: class TestAccesses:
source = Source( def setup_class(self):
self.source = Source(
"""\ """\
def f(x): def f(x):
pass pass
@ -155,7 +156,8 @@ class TestAccesses:
class TestSourceParsingAndCompiling: class TestSourceParsingAndCompiling:
source = Source( def setup_class(self):
self.source = Source(
"""\ """\
def f(x): def f(x):
assert (x == assert (x ==
@ -619,7 +621,8 @@ x = 3
class TestTry: class TestTry:
source = """\ def setup_class(self):
self.source = """\
try: try:
raise ValueError raise ValueError
except Something: except Something:
@ -646,7 +649,8 @@ else:
class TestTryFinally: class TestTryFinally:
source = """\ def setup_class(self):
self.source = """\
try: try:
raise ValueError raise ValueError
finally: finally:
@ -663,7 +667,8 @@ finally:
class TestIf: class TestIf:
source = """\ def setup_class(self):
self.source = """\
if 1: if 1:
y = 3 y = 3
elif False: elif False: