diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-02-15 17:34:31 -0800 |
---|---|---|
committer | Anthony Sottile <asottile@umich.edu> | 2019-02-16 11:23:23 -0800 |
commit | 5505826db921b0e46c30004ea20b6bf6e478e683 (patch) | |
tree | 2fc7adfee72c75cb23acc937f459219d1dd0f1e8 /testing/code | |
parent | 68dc433bf5f7bb7b6760dabb4346db1f282df532 (diff) | |
download | pytest-5505826db921b0e46c30004ea20b6bf6e478e683.tar.gz |
Fix python3.8 / pypy failures
Diffstat (limited to 'testing/code')
-rw-r--r-- | testing/code/test_source.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 0103acb70..fc5eaed04 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -560,7 +560,6 @@ def test_oneline_and_comment(): assert str(source) == "raise ValueError" -@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), reason="does not work on pypy") def test_comments(): source = '''def test(): "comment 1" @@ -576,9 +575,15 @@ comment 4 ''' for line in range(2, 6): 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(10, source)) == '"""' + for line in range(tqs_start, 10): + assert str(getstatement(line, source)) == '"""\ncomment 4\n"""' def test_comment_in_statement(): |