From e3329be2917ef8a5ce60e8ed45209d0529ee8f63 Mon Sep 17 00:00:00 2001 From: ttimasdf Date: Tue, 22 Sep 2020 16:47:43 +0800 Subject: [PATCH] tests: add test for mercury-parser --- tests/fixtures.py | 1 + tests/test_extractors.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/tests/fixtures.py b/tests/fixtures.py index 458929d3..b423c076 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -16,6 +16,7 @@ def disable_extractors_dict(): "USE_WGET": "false", "USE_SINGLEFILE": "false", "USE_READABILITY": "false", + "USE_MERCURY": "false", "SAVE_PDF": "false", "SAVE_SCREENSHOT": "false", "SAVE_DOM": "false", diff --git a/tests/test_extractors.py b/tests/test_extractors.py index 28781569..bb66a44c 100644 --- a/tests/test_extractors.py +++ b/tests/test_extractors.py @@ -30,6 +30,14 @@ def test_readability_works(tmp_path, process, disable_extractors_dict): output_file = archived_item_path / "readability" / "content.html" assert output_file.exists() +def test_mercury_works(tmp_path, process, disable_extractors_dict): + disable_extractors_dict.update({"USE_MERCURY": "true"}) + add_process = subprocess.run(['archivebox', 'add', 'http://127.0.0.1:8080/static/example.com.html'], + capture_output=True, env=disable_extractors_dict) + archived_item_path = list(tmp_path.glob("archive/**/*"))[0] + output_file = archived_item_path / "mercury" / "content.html" + assert output_file.exists() + def test_readability_works_with_wget(tmp_path, process, disable_extractors_dict): disable_extractors_dict.update({"USE_READABILITY": "true", "USE_WGET": "true"}) add_process = subprocess.run(['archivebox', 'add', 'http://127.0.0.1:8080/static/example.com.html'],