Merge pull request #4804 from asottile/fix_py38
Fix python3.8 / pypy failures
This commit is contained in:
commit
eeac28f4ab
|
@ -560,7 +560,6 @@ def test_oneline_and_comment():
|
||||||
assert str(source) == "raise ValueError"
|
assert str(source) == "raise ValueError"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), reason="does not work on pypy")
|
|
||||||
def test_comments():
|
def test_comments():
|
||||||
source = '''def test():
|
source = '''def test():
|
||||||
"comment 1"
|
"comment 1"
|
||||||
|
@ -576,9 +575,15 @@ comment 4
|
||||||
'''
|
'''
|
||||||
for line in range(2, 6):
|
for line in range(2, 6):
|
||||||
assert str(getstatement(line, source)) == " x = 1"
|
assert str(getstatement(line, source)) == " x = 1"
|
||||||
for line in range(6, 10):
|
if sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
|
||||||
|
tqs_start = 8
|
||||||
|
else:
|
||||||
|
tqs_start = 10
|
||||||
|
assert str(getstatement(10, source)) == '"""'
|
||||||
|
for line in range(6, tqs_start):
|
||||||
assert str(getstatement(line, source)) == " assert False"
|
assert str(getstatement(line, source)) == " assert False"
|
||||||
assert str(getstatement(10, source)) == '"""'
|
for line in range(tqs_start, 10):
|
||||||
|
assert str(getstatement(line, source)) == '"""\ncomment 4\n"""'
|
||||||
|
|
||||||
|
|
||||||
def test_comment_in_statement():
|
def test_comment_in_statement():
|
||||||
|
|
|
@ -910,7 +910,6 @@ def test_reportchars_all_error(testdir):
|
||||||
result.stdout.fnmatch_lines(["ERROR*test_foo*"])
|
result.stdout.fnmatch_lines(["ERROR*test_foo*"])
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail("hasattr(sys, 'pypy_version_info')")
|
|
||||||
def test_errors_in_xfail_skip_expressions(testdir):
|
def test_errors_in_xfail_skip_expressions(testdir):
|
||||||
testdir.makepyfile(
|
testdir.makepyfile(
|
||||||
"""
|
"""
|
||||||
|
@ -931,6 +930,10 @@ def test_errors_in_xfail_skip_expressions(testdir):
|
||||||
if sys.platform.startswith("java"):
|
if sys.platform.startswith("java"):
|
||||||
# XXX report this to java
|
# XXX report this to java
|
||||||
markline = "*" + markline[8:]
|
markline = "*" + markline[8:]
|
||||||
|
elif hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (6,):
|
||||||
|
markline = markline[5:]
|
||||||
|
elif sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
|
||||||
|
markline = markline[4:]
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
[
|
[
|
||||||
"*ERROR*test_nameerror*",
|
"*ERROR*test_nameerror*",
|
||||||
|
|
Loading…
Reference in New Issue