diff --git a/iommi/sql_trace__tests.py b/iommi/sql_trace__tests.py index 57b7ef77..4fb7c4bd 100644 --- a/iommi/sql_trace__tests.py +++ b/iommi/sql_trace__tests.py @@ -1,4 +1,5 @@ import logging +import os import re from datetime import ( date, @@ -59,6 +60,8 @@ def test_middleware(settings, client, caplog): settings.SQL_DEBUG_WORST_SUSPICIOUS_CUTOFF = 0 settings.SQL_DEBUG_WORST_QUERY_CUTOFF = 1 + base_path = str(Path(__file__).parent.parent.parent) + os.path.sep + with time_machine.travel('1948, 2, 19', tick=False): client.get('/no_queries/?_iommi_sql_trace') assert 'GET /no_queries/?_iommi_sql_trace -> 200 (0.000s)' in caplog.text @@ -80,7 +83,7 @@ def test_middleware(settings, client, caplog): assert select_statement in caplog.text assert 'File "iommi/sql_trace__tests.py", line ' in caplog.text.replace('iommi/iommi/', 'iommi/').replace( './', '' - ) + ).replace(base_path, '') assert re.findall(r'GET /\?_iommi_sql_trace -> 200 \(0\.\d\d\ds\) \(sql time: 0\.\d\d\ds\)', caplog.text) assert '... and 3 more unique statements' in caplog.text