Skip to content

Commit

Permalink
Fix tests for pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
7x11x13 committed Jul 26, 2024
1 parent a98b6cf commit d20279f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tests/test_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tests.utils import assert_not_track, assert_track, call_scdl_with_auth


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_original_download(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_mp3_to_stdout(tmp_path: Path) -> None:
assert_track(tmp_path, "track.mp3")


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_flac_to_stdout(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand All @@ -73,6 +75,7 @@ def test_flac_to_stdout(tmp_path: Path) -> None:
assert_track(tmp_path, "track.flac", "copy", "saves", None)


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_flac(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand All @@ -86,6 +89,7 @@ def test_flac(tmp_path: Path) -> None:
assert_track(tmp_path, "track.flac", "copy", "saves", None)


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_m4a(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand Down Expand Up @@ -163,6 +167,7 @@ def test_original_art(tmp_path: Path) -> None:
assert_track(tmp_path, "track.mp3", expected_artwork_len=3409)


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_original_name(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand All @@ -176,6 +181,7 @@ def test_original_name(tmp_path: Path) -> None:
assert_track(tmp_path, "original.wav", check_metadata=False)


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_original_metadata(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand All @@ -189,6 +195,7 @@ def test_original_metadata(tmp_path: Path) -> None:
assert_track(tmp_path, "track.wav", "og title", "og artist", "og genre", 0)


@pytest.mark.skipif(not os.getenv("AUTH_TOKEN"), reason="No auth token specified")
def test_force_metadata(tmp_path: Path) -> None:
os.chdir(tmp_path)
r = call_scdl_with_auth(
Expand Down
3 changes: 1 addition & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def call_scdl_with_auth(
*args: str,
encoding: Optional[str] = "utf-8",
) -> subprocess.CompletedProcess:
auth_token = os.getenv("AUTH_TOKEN")
assert auth_token
auth_token = os.getenv("AUTH_TOKEN", "")
args = ("scdl", *args, f"--auth-token={auth_token}", f"--client-id={client_id}")
return subprocess.run(
args,
Expand Down

0 comments on commit d20279f

Please sign in to comment.