From b817534c371196fb2eb5b73aa18cbb34d54ba7f1 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 20 Sep 2023 12:58:35 -0600 Subject: [PATCH] Adding Download.is_new/etc. for code suggestions. Fixing async test warnings. --- modules/archive/lib.py | 2 +- modules/archive/test/test_lib.py | 6 ++--- modules/videos/channel/test/test_api.py | 6 ++--- modules/videos/test/test_downloader.py | 1 - wrolpi/downloader.py | 19 +++++++++++-- wrolpi/files/test/test_api.py | 6 ++--- wrolpi/test/test_downloader.py | 22 ++++++++------- wrolpi/test/test_events.py | 9 ++++--- wrolpi/test/test_media_path.py | 36 ------------------------- wrolpi/test/test_root_api.py | 6 ++--- wrolpi/test/test_rss.py | 2 +- 11 files changed, 48 insertions(+), 67 deletions(-) delete mode 100644 wrolpi/test/test_media_path.py diff --git a/modules/archive/lib.py b/modules/archive/lib.py index 676a40a7..04f26d11 100644 --- a/modules/archive/lib.py +++ b/modules/archive/lib.py @@ -224,7 +224,7 @@ def get_title_from_html(html: str, url: str = None) -> str: try: return soup.title.string except Exception: # noqa - logger.info(f'Unable to extract title {url}') + logger.debug(f'Unable to extract title {url}') @optional_session diff --git a/modules/archive/test/test_lib.py b/modules/archive/test/test_lib.py index ad2b590c..48df01aa 100644 --- a/modules/archive/test/test_lib.py +++ b/modules/archive/test/test_lib.py @@ -169,7 +169,7 @@ def test_archive_refresh_deleted_archive(test_client, test_session, archive_dire @pytest.mark.asyncio -async def test_fills_contents_with_refresh(test_client, test_session, archive_factory, singlefile_contents_factory): +async def test_fills_contents_with_refresh(test_session, archive_factory, singlefile_contents_factory): """Refreshing archives fills in any missing contents.""" archive1 = archive_factory('example.com', 'https://example.com/one') archive2 = archive_factory('example.com', 'https://example.com/one') @@ -277,7 +277,7 @@ def test_get_domains(test_session, archive_factory): assert [i['domain'] for i in get_domains()] == [] -@pytest.mark.asycio +@pytest.mark.asyncio async def test_new_archive(test_session, fake_now): singlefile, readability, screenshot = make_fake_archive_result() fake_now(datetime(2000, 1, 1)) @@ -521,7 +521,7 @@ def test_refresh_archives(test_session, test_directory, test_client, make_files_ @pytest.mark.asyncio -async def test_refresh_archives_index(test_session, test_directory, test_client, make_files_structure): +async def test_refresh_archives_index(test_session, make_files_structure): """Archives are indexed using ArchiveIndexer and archive_modeler.""" # The start of a typical singlefile html file. singlefile_contents = '''