aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/tests/conftest.py')
-rw-r--r--packages/meshbay-node/tests/conftest.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/conftest.py b/packages/meshbay-node/tests/conftest.py
index ba86c13..692a118 100644
--- a/packages/meshbay-node/tests/conftest.py
+++ b/packages/meshbay-node/tests/conftest.py
@@ -17,6 +17,28 @@ needs_subprocess = pytest.mark.skipif(
"SelectorEventLoop for aiortc",
)
+@pytest.fixture(autouse=True)
+def _restore_media_tool_paths():
+ """Put `platform`'s resolved ffmpeg/ffprobe paths back after every test.
+
+ `check_media_tools()` writes two module globals. `monkeypatch` restores what
+ a test patched, and knows nothing about what the code under test then wrote
+ — so a test that patched `shutil.which` to a Windows path and called
+ `check_media_tools()` left `_ffprobe_path` at "/opt/bin/ffprobe.exe" for the
+ rest of the session. Seven tests in two files about video transcoding then
+ died on FileNotFoundError, for a reason nowhere near themselves, and only
+ when the whole suite ran: run those two files alone and they passed.
+
+ The instance is fixed at the call site as well; this closes the class. Any
+ future test that resolves media tools is undone here whether it remembers to
+ or not, which is the only way an order-dependent suite stops being one.
+ """
+ from meshbay_node import platform as _plat
+ before = (_plat._ffmpeg_path, _plat._ffprobe_path)
+ yield
+ _plat._ffmpeg_path, _plat._ffprobe_path = before
+
+
# Windows-only gaps still to close (see devel/windows-devel.md §5/§6).
win32_todo = pytest.mark.skipif(
sys.platform == "win32",