Skip to content

Commit bfd3cc2

Browse files
author
Andy Landy
committed
fix tests
1 parent 9c76fba commit bfd3cc2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/test_utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,19 @@ def strip_tb_text(text: str) -> str:
5959
#text = text.replace('WindowsPath', 'PosixPath') # for windows
6060
#text = re.sub(r'\n[^\n]*\^\^\^[^\n]*\n', '\n', text)
6161
# File "/usr/local/lib/python3.8/dist-packages/_pytest/_code/code.py", line 810, in repr_traceback_entry
62-
text = re.sub(r'/[\w/.-]+/[\d]+\.py([^\w/-])', fr'{OFTO}\1', text)
63-
text = re.sub(r'([^\w/.-])/[\w/.-]+(/[\w.-]+[^\w/.-])', fr'\1{OFTO}\2', text)
64-
text = re.sub(r'/[\w/.-]+(/[\w.-]+\.py[^\w/-])', fr'{OFTO}\1', text)
62+
63+
text = re.sub(r'/[\w/.-]+(/[\w.-]+\.py[^\w/-])', fr'{OFTO}\1', text) # machine-dependent paths
64+
#text = re.sub(r'([^\w/.-])/[\w/.-]+(/[\w.-]+[^\w/.-])', fr'\1{OFTO}\2', text)
65+
#text = re.sub(r'/[\w/.-]+(/[\w.-]+\.py[^\w/-])', fr'{OFTO}\1', text)
66+
6567
#text = re.sub(r'(line)[^\n,]+(,)', fr'\1{OFTO}\2', text)
68+
text = re.sub(r'(/argparse.py", line )[^\n,]+(,)', fr'\1{OFTO}\2', text) # argparse versions
6669
#text = re.sub(r"(__file__ = )[^\n]*\n", fr"\1'{OFTO}'", text)
67-
text = re.sub(r'( at 0x)\w+', fr'\1{OFTO}', text)
70+
text = re.sub(r'( at 0x)\w+', fr'\1{OFTO}', text) # object ids
6871
#text = re.sub(r'(__builtins__[^{]*{)[^\n]*', fr'\1{OFTO}', text)
6972
#text = re.sub(r'(<ipython-input-)\d+-\w+(>)', fr'{OFTO}', text)
70-
#text = re.sub('\n[^\n]+function open[^\n]+\n', '\n', text)
73+
text = re.sub(r'(<ipython-input-)[^>]+(>)', fr'\1{OFTO}\2', text)
74+
text = re.sub('\n[^\n]+function open[^\n]+\n', '\n', text) # Jupyter versions?
7175
#text = re.sub('\n[^\n]+_pytest[^\n]+\n', '\n', text)
7276
#text = re.sub(', required=True', '', text)
7377
#text = re.sub('integer division or modulo', 'division', text)

0 commit comments

Comments
 (0)