Deprecate yield tests

Closes #16
Closes #1324
This commit is contained in:
Bruno Oliveira
2016-07-11 21:06:35 -03:00
parent 6f68dfcc47
commit 5506dc700c
4 changed files with 24 additions and 8 deletions

View File

@@ -285,13 +285,14 @@ class TestSourceParsingAndCompiling:
#print "block", str(block)
assert str(stmt).strip().startswith('assert')
def test_compilefuncs_and_path_sanity(self):
@pytest.mark.parametrize('name', ['', None, 'my'])
def test_compilefuncs_and_path_sanity(self, name):
def check(comp, name):
co = comp(self.source, name)
if not name:
expected = "codegen %s:%d>" %(mypath, mylineno+2+1)
expected = "codegen %s:%d>" %(mypath, mylineno+2+2)
else:
expected = "codegen %r %s:%d>" % (name, mypath, mylineno+2+1)
expected = "codegen %r %s:%d>" % (name, mypath, mylineno+2+2)
fn = co.co_filename
assert fn.endswith(expected)
@@ -300,8 +301,7 @@ class TestSourceParsingAndCompiling:
mypath = mycode.path
for comp in _pytest._code.compile, _pytest._code.Source.compile:
for name in '', None, 'my':
yield check, comp, name
check(comp, name)
def test_offsetless_synerr(self):
pytest.raises(SyntaxError, _pytest._code.compile, "lambda a,a: 0", mode='eval')