Skip to content

Commit

Permalink
make sure rar file exists in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed Mar 4, 2025
1 parent 5d46fec commit 2237c44
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import annotations

import os
import sys
from datetime import datetime, timedelta, timezone
from pathlib import Path
from textwrap import dedent
Expand Down Expand Up @@ -30,11 +29,6 @@
# Core test
pytestmark = pytest.mark.core

unix_platform = pytest.mark.skipif(
not sys.platform.startswith('linux'),
reason='only on linux platform',
)


def ensure(path: str | os.PathLike[str], *, directory: bool = False) -> Path:
"""Create a file (or directory) at path."""
Expand Down Expand Up @@ -308,10 +302,11 @@ def test_scan_video_movie_name_path_does_not_exist(movies: dict[str, Movie]) ->
assert scanned_video.year == video.year


@unix_platform
def test_scan_archive_error(
rar: dict[str, str],
) -> None:
if 'pwd-protected' not in rar:
return
path = rar['pwd-protected']
with pytest.raises(ArchiveError):
scan_archive(path)
Expand All @@ -320,11 +315,12 @@ def test_scan_archive_error(
scan_video_or_archive(path)


@unix_platform
def test_scan_videos_error(
rar: dict[str, str],
caplog: pytest.LogCaptureFixture,
) -> None:
if 'pwd-protected' not in rar:
return
folder = Path(rar['pwd-protected']).parent
# Test return without error
scan_videos(folder)
Expand Down

0 comments on commit 2237c44

Please sign in to comment.