File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import importlib
34import os
45import sys
56from pathlib import Path
67
78import pytest
89
9- from app .auth import AUTH_FAILURE_TRACKER
10-
11- # Ensure project root (where 'app' package resides) is on sys.path
10+ # Adjust sys.path early so subsequent imports resolve
1211ROOT = Path (__file__ ).resolve ().parent .parent
1312if str (ROOT ) not in sys .path :
1413 sys .path .insert (0 , str (ROOT ))
1514
16- # Provide default API key for any imports needing it
15+ # Provide default API key before importing modules that validate it at import time
1716os .environ .setdefault ("DEVIL_API_KEY" , "devil" )
1817
18+ # Lazy import after env var is ensured while keeping all import statements grouped at the top
19+ AUTH_FAILURE_TRACKER = importlib .import_module ("app.auth" ).AUTH_FAILURE_TRACKER
20+
1921
2022@pytest .fixture (autouse = True )
2123def reset_auth_tracker ():
You can’t perform that action at this time.
0 commit comments