24 lines
913 B
Python
24 lines
913 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import tempfile
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.skipif(
|
|
os.environ.get("MATRIX_LEGACY_ISOLATION_PROBE") != "1",
|
|
reason="only executed by the isolated legacy-worker compatibility test",
|
|
)
|
|
def test_legacy_worker_paths_are_transaction_scoped(tmp_path):
|
|
root = Path(os.environ["MATRIX_TEST_ROOT"]).resolve()
|
|
assert Path(os.environ["MATRIX_DATA_DIR"]).resolve().is_relative_to(root)
|
|
assert Path(os.environ["MATRIX_RUNTIME_DIR"]).resolve().is_relative_to(root)
|
|
assert Path(tempfile.gettempdir()).resolve().is_relative_to(root)
|
|
assert tmp_path.resolve().is_relative_to(root)
|
|
with tempfile.NamedTemporaryFile() as handle:
|
|
assert Path(handle.name).resolve().is_relative_to(root)
|
|
if os.environ.get("MATRIX_STRICT_PYTEST_FAILURE_PROBE") == "1":
|
|
pytest.fail("strict legacy-worker pytest probe executed")
|