From ef6de537760ad5c7cf23505efa065229fa7530f3 Mon Sep 17 00:00:00 2001 From: Arsenii es3n1n Date: Mon, 8 Jul 2024 20:10:44 +0200 Subject: [PATCH] Making things easier for scdl-as-a-lib users (#498) * refactor: don't touch the global logging config * test: skip m4a test if there's no go+ sub instead of erroring * Log to stderr --------- Co-authored-by: 7x11x13 --- scdl/scdl.py | 3 +-- tests/test_track.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scdl/scdl.py b/scdl/scdl.py index 5799c01..820f474 100644 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -109,11 +109,10 @@ from tqdm import tqdm from scdl import __version__, utils from scdl.metadata_assembler import METADATA_ASSEMBLERS, MetadataInfo -logging.basicConfig(level=logging.INFO, format="%(message)s") -logging.getLogger("requests").setLevel(logging.WARNING) logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) logger.addFilter(utils.ColorizeFilter()) +logger.addHandler(logging.StreamHandler()) FFMPEG_PIPE_CHUNK_SIZE = 1024 * 1024 # 1 mb diff --git a/tests/test_track.py b/tests/test_track.py index b8bbf67..25c5e77 100644 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -1,4 +1,5 @@ import os +import pytest from pathlib import Path from tests.utils import assert_not_track, assert_track, call_scdl_with_auth @@ -91,7 +92,8 @@ def test_m4a(tmp_path: Path): "--opus", ) assert r.returncode == 0 - assert not (tmp_path / 'track.opus').exists(), 'Please make sure that you have a GO+ subscription' + if (tmp_path / 'track.opus').exists(): + pytest.skip('No go+ subscription') assert_track( tmp_path, "track.m4a",