mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-15 23:54:48 -04:00
Fix lints on tests
This commit is contained in:
parent
178168cc68
commit
601241d1fb
8 changed files with 41 additions and 46 deletions
2
tests/fixtures/clients.py
vendored
2
tests/fixtures/clients.py
vendored
|
@ -4,8 +4,8 @@ import os
|
|||
import pytest
|
||||
from util import arun
|
||||
|
||||
from streamrip.config import Config
|
||||
from streamrip.client.qobuz import QobuzClient
|
||||
from streamrip.config import Config
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
|
|
6
tests/fixtures/util.py
vendored
6
tests/fixtures/util.py
vendored
|
@ -9,9 +9,9 @@ def arun(coro):
|
|||
|
||||
def afor(async_gen):
|
||||
async def _afor(async_gen):
|
||||
l = []
|
||||
item = []
|
||||
async for item in async_gen:
|
||||
l.append(item)
|
||||
return l
|
||||
item.append(item)
|
||||
return item
|
||||
|
||||
return arun(_afor(async_gen))
|
||||
|
|
|
@ -4,8 +4,28 @@ import shutil
|
|||
import pytest
|
||||
import tomlkit
|
||||
|
||||
from streamrip.config import *
|
||||
from streamrip.config import _get_dict_keys_r, _nested_set
|
||||
from streamrip.config import (
|
||||
ArtworkConfig,
|
||||
CliConfig,
|
||||
Config,
|
||||
ConfigData,
|
||||
ConversionConfig,
|
||||
DatabaseConfig,
|
||||
DeezerConfig,
|
||||
DownloadsConfig,
|
||||
FilepathsConfig,
|
||||
LastFmConfig,
|
||||
MetadataConfig,
|
||||
MiscConfig,
|
||||
QobuzConfig,
|
||||
QobuzDiscographyFilterConfig,
|
||||
SoundcloudConfig,
|
||||
TidalConfig,
|
||||
YoutubeConfig,
|
||||
_get_dict_keys_r,
|
||||
_nested_set,
|
||||
update_config,
|
||||
)
|
||||
|
||||
SAMPLE_CONFIG = "tests/test_config.toml"
|
||||
OLD_CONFIG = "tests/test_config_old.toml"
|
||||
|
@ -242,15 +262,6 @@ def test_sample_config_data_fields(sample_config_data):
|
|||
assert sample_config_data.conversion == test_config.conversion
|
||||
|
||||
|
||||
# def test_config_save_file_called_on_del(sample_config, mocker):
|
||||
# sample_config.file.set_modified()
|
||||
# mockf = mocker.Mock()
|
||||
#
|
||||
# sample_config.save_file = mockf
|
||||
# sample_config.__del__()
|
||||
# mockf.assert_called_once()
|
||||
|
||||
|
||||
def test_config_update_on_save():
|
||||
tmp_config_path = "tests/config2.toml"
|
||||
shutil.copy(SAMPLE_CONFIG, tmp_config_path)
|
||||
|
@ -264,19 +275,6 @@ def test_config_update_on_save():
|
|||
assert conf2.session.downloads.folder == "new_folder"
|
||||
|
||||
|
||||
# def test_config_update_on_del():
|
||||
# tmp_config_path = "tests/config2.toml"
|
||||
# shutil.copy(SAMPLE_CONFIG, tmp_config_path)
|
||||
# conf = Config(tmp_config_path)
|
||||
# conf.file.downloads.folder = "new_folder"
|
||||
# conf.file.set_modified()
|
||||
# del conf
|
||||
# conf2 = Config(tmp_config_path)
|
||||
# os.remove(tmp_config_path)
|
||||
#
|
||||
# assert conf2.session.downloads.folder == "new_folder"
|
||||
|
||||
|
||||
def test_config_dont_update_without_set_modified():
|
||||
tmp_config_path = "tests/config2.toml"
|
||||
shutil.copy(SAMPLE_CONFIG, tmp_config_path)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import pytest
|
||||
import tomlkit
|
||||
from tomlkit.toml_document import TOMLDocument
|
||||
|
||||
from streamrip.config import *
|
||||
from streamrip.config import ConfigData
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
|
||||
from streamrip.metadata import *
|
||||
from streamrip.metadata import AlbumMetadata, TrackMetadata
|
||||
|
||||
with open("tests/qobuz_album_resp.json") as f:
|
||||
qobuz_album_resp = json.load(f)
|
||||
|
@ -16,7 +16,7 @@ def test_album_metadata_qobuz():
|
|||
assert info.quality == 3
|
||||
assert info.container == "FLAC"
|
||||
assert info.label == "Rhino - Warner Records"
|
||||
assert info.explicit == False
|
||||
assert info.explicit is False
|
||||
assert info.sampling_rate == 96
|
||||
assert info.bit_depth == 24
|
||||
assert info.booklets is None
|
||||
|
|
|
@ -5,7 +5,14 @@ import pytest
|
|||
from mutagen.flac import FLAC
|
||||
from util import arun
|
||||
|
||||
from streamrip.metadata import *
|
||||
from streamrip.metadata import (
|
||||
AlbumInfo,
|
||||
AlbumMetadata,
|
||||
Covers,
|
||||
TrackInfo,
|
||||
TrackMetadata,
|
||||
tag_file,
|
||||
)
|
||||
|
||||
TEST_FLAC_ORIGINAL = "tests/silence.flac"
|
||||
TEST_FLAC_COPY = "tests/silence_copy.flac"
|
||||
|
|
|
@ -25,19 +25,8 @@ def test_pending_resolve(qobuz_client: QobuzClient):
|
|||
dir = "tests/tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]"
|
||||
assert os.path.isdir(dir)
|
||||
assert os.path.isfile(os.path.join(dir, "cover.jpg"))
|
||||
# embedded_cover_path aka t.cover_path is
|
||||
# ./tests/./tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]/
|
||||
# __artwork/cover-9202762427033526105.jpg
|
||||
assert os.path.isfile(t.cover_path)
|
||||
assert isinstance(t, Track)
|
||||
assert isinstance(t.downloadable, Downloadable)
|
||||
assert t.cover_path is not None
|
||||
shutil.rmtree(dir)
|
||||
|
||||
|
||||
# def test_pending_resolve_mp3(qobuz_client: QobuzClient):
|
||||
# qobuz_client.config.session.qobuz.quality = 1
|
||||
# p = PendingSingle("19512574", qobuz_client, qobuz_client.config)
|
||||
# t = arun(p.resolve())
|
||||
# assert isinstance(t, Track)
|
||||
# assert False
|
||||
|
|
|
@ -9,9 +9,9 @@ def arun(coro):
|
|||
|
||||
def afor(async_gen):
|
||||
async def _afor(async_gen):
|
||||
l = []
|
||||
items = []
|
||||
async for item in async_gen:
|
||||
l.append(item)
|
||||
return l
|
||||
items.append(item)
|
||||
return items
|
||||
|
||||
return arun(_afor(async_gen))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue