From c7f2db1f9d50d4255107512dd86755efc6deedc6 Mon Sep 17 00:00:00 2001 From: Tristan Lee Date: Thu, 21 Sep 2023 05:51:28 -0500 Subject: [PATCH] no way to robustly set Windows files to readonly, so removed those tests --- .github/workflows/pytest.yml | 5 ++++- .github/workflows/pytest_windows.yml | 2 +- tests/cli.py | 26 -------------------------- tiktok_hashtag_analysis/base.py | 2 +- 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ed0cf6e..c26c897 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -12,4 +12,7 @@ jobs: python-version: '3.9' - run: pip install -e .[dev] - run: python -m playwright install - - run: pytest --exitfirst --failed-first \ No newline at end of file + - run: | + export DISPLAY=:99 + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + pytest \ No newline at end of file diff --git a/.github/workflows/pytest_windows.yml b/.github/workflows/pytest_windows.yml index b1be78c..baf3eb4 100644 --- a/.github/workflows/pytest_windows.yml +++ b/.github/workflows/pytest_windows.yml @@ -12,4 +12,4 @@ jobs: python-version: '3.9' - run: pip install -e .[dev] - run: python -m playwright install - - run: pytest --exitfirst --failed-first \ No newline at end of file + - run: pytest \ No newline at end of file diff --git a/tests/cli.py b/tests/cli.py index b489828..d4fe319 100644 --- a/tests/cli.py +++ b/tests/cli.py @@ -42,32 +42,6 @@ def test_parser(hashtags, attribute, value, flag): assert args.get("hashtags") == hashtags -def test_output_dir_spec_noexist_nowrite(tmp_path): - # Specified nonexistent output directory without write permissions - parser = create_parser() - os.chmod(tmp_path, 0o444) - specified_output_dir = tmp_path / "test" - with pytest.raises(SystemExit) as system_exit: - result = process_output_dir( - specified_output_dir=specified_output_dir, parser=parser - ) - assert system_exit.type == SystemExit - os.chmod(tmp_path, 0o666) - - -def test_output_dir_spec_exist_nowrite(tmp_path): - # Specified existing output directory without write permissions - parser = create_parser() - os.chmod(tmp_path, 0o444) - specified_output_dir = tmp_path - with pytest.raises(SystemExit) as system_exit: - result = process_output_dir( - specified_output_dir=specified_output_dir, parser=parser - ) - assert system_exit.type == SystemExit - os.chmod(tmp_path, 0o666) - - def test_output_dir_unspec_nowrite(monkeypatch, tmp_path): # Unspecified, in current directory without write permissions parser = create_parser() diff --git a/tiktok_hashtag_analysis/base.py b/tiktok_hashtag_analysis/base.py index bcfcfcb..93616f3 100644 --- a/tiktok_hashtag_analysis/base.py +++ b/tiktok_hashtag_analysis/base.py @@ -184,7 +184,7 @@ def get_hashtag_posts(self, hashtag: str, limit: int, headed: bool): ) except Exception as e: logger.warning( - "Encountered error {e} when fetching data, retrying in headed mode" + f"Encountered error {e} when fetching data, retrying in headed mode" ) fetched_data = asyncio.run( _fetch_hashtag_data(hashtag=hashtag, limit=limit, headed=True)