Keep integration imports lightweight
All checks were successful
Container Image / build-and-push (push) Successful in 22s
All checks were successful
Container Image / build-and-push (push) Successful in 22s
This commit is contained in:
25
tests/test_integrations_import_lightweight.py
Normal file
25
tests/test_integrations_import_lightweight.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def test_integrations_import_does_not_initialize_core_package():
|
||||
env = dict(os.environ)
|
||||
env["PYTHONPATH"] = os.getcwd()
|
||||
code = (
|
||||
"import json, sys; "
|
||||
"import src.integrations; "
|
||||
"import src.secret_storage; "
|
||||
"print(json.dumps({'core_loaded': 'core' in sys.modules}))"
|
||||
)
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-c", code],
|
||||
cwd=os.getcwd(),
|
||||
env=env,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
timeout=10,
|
||||
check=True,
|
||||
)
|
||||
assert json.loads(result.stdout) == {"core_loaded": False}
|
||||
Reference in New Issue
Block a user