summaryrefslogtreecommitdiff
path: root/tests/test_parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-30 11:25:40 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-30 11:25:40 -0400
commit19438b7b811ccb4f6c3259f627bfcc0d852e5003 (patch)
tree620171a0137fa58d59586f92bbb593c6b9419601 /tests/test_parser.py
parent3d962a30a3f659978b96ef59811e8062867b358b (diff)
downloadpython-coveragepy-git-19438b7b811ccb4f6c3259f627bfcc0d852e5003.tar.gz
test: fix the trailing-space test, and suppress warnings about \<space>
Diffstat (limited to 'tests/test_parser.py')
-rw-r--r--tests/test_parser.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 48963358..d5f43197 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -5,6 +5,7 @@
import os.path
import textwrap
+import warnings
import pytest
@@ -492,8 +493,10 @@ def test_ast_dump():
with open(fname) as f:
source = f.read()
num_lines = len(source.splitlines())
- print(f"file {fname} has {num_lines} lines")
- ast_root = ast_parse(source)
+ with warnings.catch_warnings():
+ # stress_phystoken.tok has deprecation warnings, suppress them.
+ warnings.filterwarnings("ignore", message=r".*invalid escape sequence",)
+ ast_root = ast_parse(source)
result = []
ast_dump(ast_root, print=result.append)
if num_lines < 100: