Browse Source

Make Debug message test cases independent from line numbers, Windows support

pull/2693/head
Tamas Kocsis 1 year ago
parent
commit
1b4f93f14b
  1. 13
      src/Test/TestDebug.py

13
src/Test/TestDebug.py

@ -1,6 +1,7 @@
from Debug import Debug
import gevent
import os
import re
import pytest
@ -37,17 +38,15 @@ class TestDebug:
q_items.append((file, int(line)))
assert Debug.formatTraceback(q_items) == expected
def testFormatException(self):
try:
raise ValueError("Test exception")
except:
assert Debug.formatException() == "ValueError: Test exception in TestDebug.py line 43"
except Exception:
assert re.match(r"ValueError: Test exception in TestDebug.py line [0-9]+", Debug.formatException())
try:
os.path.abspath(1)
except:
assert "in TestDebug.py line 47 > <posixpath> line " in Debug.formatException()
except Exception:
assert re.search(r"in TestDebug.py line [0-9]+ > <(posixpath|ntpath)> line ", Debug.formatException())
def testFormatStack(self):
assert Debug.formatStack().startswith("TestDebug.py line 53 > <_pytest>/python.py line ")
assert re.match(r"TestDebug.py line [0-9]+ > <_pytest>/python.py line [0-9]+", Debug.formatStack())

Loading…
Cancel
Save