diff --git a/modules/archive/test/test_api.py b/modules/archive/test/test_api.py index 2a9509b6..8b601c4a 100644 --- a/modules/archive/test/test_api.py +++ b/modules/archive/test/test_api.py @@ -6,7 +6,7 @@ import pytest from modules.archive import lib, Archive from wrolpi.common import get_relative_to_media_directory -from wrolpi.test.common import skip_circleci, skip_macos +from wrolpi.test.common import skip_ci, skip_macos async def check_results(async_client, data, ids): @@ -194,7 +194,7 @@ async def test_archives_search_no_query(test_session, archive_factory, async_cli @skip_macos -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_archive_upload(test_session, async_client, singlefile_contents_factory, make_multipart_form, await_switches, events_fixture): diff --git a/modules/archive/test/test_lib.py b/modules/archive/test/test_lib.py index de5bad0d..9ba1adc0 100644 --- a/modules/archive/test/test_lib.py +++ b/modules/archive/test/test_lib.py @@ -21,7 +21,7 @@ from wrolpi.collections import Collection from wrolpi.common import get_wrolpi_config from wrolpi.db import get_db_session from wrolpi.files.models import FileGroup -from wrolpi.test.common import skip_circleci +from wrolpi.test.common import skip_ci def make_fake_archive_result(readability=True, screenshot=True, title=True): @@ -289,7 +289,7 @@ def test_get_domains(test_session, archive_factory): assert [i['domain'] for i in get_domains()] == [] -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_new_archive(test_session, test_directory, fake_now, async_client): singlefile, readability, screenshot = make_fake_archive_result() @@ -363,7 +363,7 @@ async def test_get_title_from_html(test_directory, test_session, fake_now, async assert archive.file_group.title is None -@skip_circleci +@skip_ci def test_get_new_archive_files_length(test_directory, fake_now): """Archive titles are truncated to fit file system BYTE limit (200 bytes - see MAXIMUM_FILE_BYTES).""" from wrolpi.common import MAXIMUM_FILE_BYTES @@ -378,7 +378,7 @@ def test_get_new_archive_files_length(test_directory, fake_now): assert len(str(archive_files.screenshot.name).encode('utf-8')) <= MAXIMUM_FILE_BYTES -@skip_circleci +@skip_ci def test_get_new_archive_files(test_directory, fake_now): """Archive files have a specific format, so they are sorted by datetime, and are near each other.""" fake_now(datetime(2001, 1, 1)) @@ -399,7 +399,7 @@ def test_get_new_archive_files(test_directory, fake_now): assert str(archive_files.screenshot).endswith('archive/example.com/2001-01-01-00-00-00_Title.png') -@skip_circleci +@skip_ci def test_get_new_archive_files_with_destination(test_directory, fake_now): """Archive files can be created in a custom destination directory instead of the default.""" fake_now(datetime(2001, 1, 1)) @@ -420,7 +420,7 @@ def test_get_new_archive_files_with_destination(test_directory, fake_now): assert str(archive_files.screenshot).endswith('archive/News/custom-domain.com/2001-01-01-00-00-00_Title.png') -@skip_circleci +@skip_ci def test_get_new_archive_files_with_subdirectory_format(test_directory, fake_now): """Archive files use subdirectories when the config format contains subdirectories.""" from modules.archive.lib import get_archive_downloader_config @@ -452,7 +452,7 @@ def test_get_new_archive_files_with_subdirectory_format(test_directory, fake_now config._config['file_name_format'] = original_format -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_title_in_filename(async_client, test_session, fake_now, test_directory, image_bytes_factory): """ @@ -1147,7 +1147,7 @@ def test_link_domain_and_downloads(test_session, test_download_manager): assert download4.collection_id is None # no frequency = no link -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_archive_download_uses_domain_collection_directory(async_client, test_session, test_directory, fake_now, monkeypatch): @@ -1209,7 +1209,7 @@ async def test_archive_download_uses_domain_collection_directory(async_client, t f"Archive should be in domain collection directory {custom_dir}, but was in {archive.singlefile_path.parent}" -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_archive_download_explicit_destination_overrides_domain_collection( async_client, test_session, test_directory, fake_now, monkeypatch): diff --git a/modules/videos/test/test_downloader.py b/modules/videos/test/test_downloader.py index 0af65528..0674a1fe 100644 --- a/modules/videos/test/test_downloader.py +++ b/modules/videos/test/test_downloader.py @@ -16,7 +16,7 @@ from modules.videos.models import Channel, Video from wrolpi.conftest import test_directory, await_switches from wrolpi.downloader import Download, DownloadResult, get_download_manager_config from wrolpi.errors import InvalidDownload, UnrecoverableDownloadError -from wrolpi.test.common import skip_circleci +from wrolpi.test.common import skip_ci from wrolpi.vars import PROJECT_DIR example_video_json = { @@ -131,7 +131,7 @@ async def test_download_video_tags(test_session, video_download_manager, video_f assert [i.tag.name for i in video.file_group.tag_files] == [tag1.name, tag2.name] -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_download_channel(test_session, test_directory, simple_channel, video_download_manager, video_file, mock_video_extract_info, mock_video_prepare_filename, await_switches, diff --git a/modules/zim/test/test_lib.py b/modules/zim/test/test_lib.py index 961c896f..1a07cf39 100644 --- a/modules/zim/test/test_lib.py +++ b/modules/zim/test/test_lib.py @@ -11,7 +11,7 @@ from wrolpi import tags, flags from wrolpi.common import DownloadFileInfo, get_wrolpi_config from wrolpi.downloader import Download, import_downloads_config, get_download_manager_config from wrolpi.files.models import FileGroup -from wrolpi.test.common import skip_circleci +from wrolpi.test.common import skip_ci @pytest.mark.asyncio @@ -181,7 +181,7 @@ def test_zim_all_entries(test_session, test_zim): assert len(entries) == 12 -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_zim_download(test_session, kiwix_download_zim, test_directory, test_zim_bytes, flags_lock, await_switches): diff --git a/wrolpi/files/test/test_downloader.py b/wrolpi/files/test/test_downloader.py index 49fcfeee..d6ce3e9d 100644 --- a/wrolpi/files/test/test_downloader.py +++ b/wrolpi/files/test/test_downloader.py @@ -9,10 +9,10 @@ from wrolpi.common import DownloadFileInfo from wrolpi.downloader import Download from wrolpi.errors import UnrecoverableDownloadError from wrolpi.files.downloader import FileDownloader, PreparedFile, file_downloader -from wrolpi.test.common import skip_circleci +from wrolpi.test.common import skip_ci -@skip_circleci +@skip_ci async def test_file_downloader(test_session, make_files_structure, test_directory, await_switches, simple_file_server, test_download_manager, video_file, video_bytes): """The FileDownloader can download a file without a metalink file.""" @@ -51,7 +51,7 @@ META4_XML = ''' ''' -@skip_circleci +@skip_ci async def test_file_downloader_meta4(test_session, make_files_structure, test_directory, await_switches, simple_file_server, test_download_manager, video_file, video_bytes): """The FileDownloader can download a file using a Metalink file.""" @@ -120,7 +120,7 @@ async def test_get_download_info_uuid_fallback(): assert info.name == 'somefile.tar.gz' -@skip_circleci +@skip_ci async def test_file_downloader_aria2c_uses_output_flag(test_directory): """The aria2c command includes -o with the predicted filename when not using metalink.""" file_downloader = FileDownloader() @@ -159,7 +159,7 @@ async def test_file_downloader_aria2c_uses_output_flag(test_directory): assert captured_cmd[o_index + 1] == 'somefile.tar.gz' -@skip_circleci +@skip_ci async def test_file_downloader_meta4_no_output_flag(test_directory): """The aria2c command should NOT include -o when using a metalink file.""" file_downloader = FileDownloader() diff --git a/wrolpi/files/test/test_lib.py b/wrolpi/files/test/test_lib.py index f74f9748..fe4265ed 100644 --- a/wrolpi/files/test/test_lib.py +++ b/wrolpi/files/test/test_lib.py @@ -21,7 +21,7 @@ from wrolpi.errors import InvalidFile, UnknownDirectory, FileGroupIsTagged, NoPr from wrolpi.files import lib, indexers from wrolpi.files.models import FileGroup, Directory from wrolpi.tags import TagFile -from wrolpi.test.common import only_macos, skip_circleci +from wrolpi.test.common import only_macos, skip_ci from wrolpi.vars import PROJECT_DIR, IS_MACOS @@ -663,7 +663,7 @@ async def test_refresh_a_text_no_indexer(async_client, test_session, make_files_ assert files == {'bar bar bar-bar', 'foo'} -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_refresh_many_files(async_client, test_session, make_files_structure, refresh_files): """Used to profile file refreshing""" @@ -712,7 +712,7 @@ async def test_mime_type(async_client, test_session, make_files_structure, test_ assert empty.mimetype == 'inode/x-empty' -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_files_indexer(async_client, test_session, make_files_structure, test_directory, refresh_files, await_background_tasks): diff --git a/wrolpi/test/common.py b/wrolpi/test/common.py index 9dd35765..cdc37be3 100644 --- a/wrolpi/test/common.py +++ b/wrolpi/test/common.py @@ -11,11 +11,11 @@ import pytest from wrolpi.api_utils import CustomJSONEncoder from wrolpi.common import get_media_directory from wrolpi.conftest import test_db, async_client # noqa -from wrolpi.vars import CIRCLECI, IS_MACOS +from wrolpi.vars import IS_CI, IS_MACOS TEST_CONFIG_PATH = tempfile.NamedTemporaryFile(mode='rt', delete=False) -skip_circleci = pytest.mark.skipif(CIRCLECI, reason='This test is not supported in CI') +skip_ci = pytest.mark.skipif(IS_CI, reason='This test is not supported in CI') skip_macos = pytest.mark.skipif(IS_MACOS, reason='This test is not supported on MacOS') only_macos = pytest.mark.skipif(not IS_MACOS, reason='This test is only supported on MacOS') diff --git a/wrolpi/test/test_common.py b/wrolpi/test/test_common.py index 48aab779..96266018 100644 --- a/wrolpi/test/test_common.py +++ b/wrolpi/test/test_common.py @@ -25,7 +25,7 @@ from wrolpi import common from wrolpi.common import cum_timer, TIMERS, print_timer, limit_concurrent, run_after, get_wrolpi_config, TRACE_LEVEL, \ is_tempfile from wrolpi.errors import InvalidConfig -from wrolpi.test.common import build_test_directories, skip_circleci, skip_macos +from wrolpi.test.common import build_test_directories, skip_ci, skip_macos def test_build_video_directories(test_directory): @@ -872,7 +872,7 @@ def test_config_backup(async_client, test_wrolpi_config, test_directory): @pytest.mark.asyncio -@skip_circleci +@skip_ci async def test_aiohttp(simple_file_server): """Test that aiohttp convenience functions work.""" host, port = simple_file_server.server_address @@ -921,7 +921,7 @@ async def test_log_level(async_client, test_wrolpi_config): @skip_macos -@skip_circleci +@skip_ci def test_html_screenshot(singlefile_contents_factory): assert common.html_screenshot(singlefile_contents_factory()) diff --git a/wrolpi/test/test_events.py b/wrolpi/test/test_events.py index 9998e75b..dc7675cb 100644 --- a/wrolpi/test/test_events.py +++ b/wrolpi/test/test_events.py @@ -8,7 +8,7 @@ import pytest from wrolpi.dates import now from wrolpi.events import HISTORY_SIZE, Events, get_events -from wrolpi.test.common import assert_dict_contains, skip_circleci +from wrolpi.test.common import assert_dict_contains, skip_ci def assert_events(expected: List[Dict], after=None): @@ -17,7 +17,7 @@ def assert_events(expected: List[Dict], after=None): assert_dict_contains(event, expected) -@skip_circleci +@skip_ci @pytest.mark.asyncio async def test_events_api_feed(test_session, async_client, example_pdf, events_fixture): """Events can be gotten from the API.""" diff --git a/wrolpi/vars.py b/wrolpi/vars.py index 930f43c3..5c9b8416 100644 --- a/wrolpi/vars.py +++ b/wrolpi/vars.py @@ -57,8 +57,8 @@ PYTEST = 'pytest' in sys.modules # Used to test if the Internet is up. INTERNET_SERVER = os.environ.get('INTERNET_SERVER', 'one.one.one.one') -# Running on a hosted CI runner (CircleCI or GitHub Actions), which lacks things some tests need. -CIRCLECI = truthy_arg(os.environ.get('CIRCLECI', '')) or truthy_arg(os.environ.get('GITHUB_ACTIONS', '')) +# Running on a GitHub Actions runner, which lacks things some tests need. +IS_CI = truthy_arg(os.environ.get('GITHUB_ACTIONS', '')) # Get the media directory from the environment. DEFAULT_MEDIA_DIRECTORY = Path('/media/wrolpi')