From e06b0c058584d5e77699a41befca70b9c4a2b8b7 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Wed, 26 Mar 2025 23:03:48 +0400 Subject: [PATCH] Skip checking if docker is running for tests + more graceful test for filename --- tests/conftest.py | 1 + tests/extractors/test_generic_extractor.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b686319..b831e65 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -142,6 +142,7 @@ def unpickle(): @pytest.fixture def mock_binary_dependencies(mocker): + mocker.patch("subprocess.run").return_value = mocker.Mock(returncode=0) mock_shutil_which = mocker.patch("shutil.which") # Mock all binary dependencies as available mock_shutil_which.return_value = "/usr/bin/fake_binary" diff --git a/tests/extractors/test_generic_extractor.py b/tests/extractors/test_generic_extractor.py index 85a0364..2fb5c35 100644 --- a/tests/extractors/test_generic_extractor.py +++ b/tests/extractors/test_generic_extractor.py @@ -36,7 +36,7 @@ class TestGenericExtractor(TestExtractorBase): package = "auto_archiver.modules.generic_extractor" assert self.extractor.dropin_for_name("bluesky", package=package) - # test loading dropings via filepath + # test loading dropins via filepath path = os.path.join(dirname(dirname(__file__)), "data/") assert self.extractor.dropin_for_name("dropin", additional_paths=[path]) @@ -121,7 +121,7 @@ class TestGenericExtractor(TestExtractorBase): == "Buy NEW Keyboard Cat Merch! https://keyboardcat.creator-spring.com\n\nxo Keyboard Cat memes make your day better!\nhttp://www.keyboardcatstore.com/\nhttps://www.facebook.com/thekeyboardcat\nhttp://www.charlieschmidt.com/" ) assert len(result.media) == 2 - assert Path(result.media[0].filename).name == "J---aiyznGQ.webm" + assert "J---aiyznGQ" in Path(result.media[0].filename).name assert Path(result.media[1].filename).name == "hqdefault.jpg" @pytest.mark.download