test(analyzer): use pathlib for tmp paths
This commit is contained in:
parent
98cea4dcd2
commit
dac09869f3
2 changed files with 19 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
|||
import shutil
|
||||
from tempfile import TemporaryDirectory
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from libretime_shared.logging import TRACE, setup_logger
|
||||
|
@ -12,17 +12,17 @@ AUDIO_FILENAME = "s1-stereo-tagged.mp3"
|
|||
AUDIO_FILE = fixtures_path / AUDIO_FILENAME
|
||||
AUDIO_IMPORT_DEST = f"Test Artist/Test Album/{AUDIO_FILENAME}"
|
||||
|
||||
# TODO: Use pathlib for file manipulation
|
||||
|
||||
@pytest.fixture()
|
||||
def dest_dir(tmp_path: Path):
|
||||
dest = tmp_path / "dest"
|
||||
dest.mkdir()
|
||||
yield dest
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def dest_dir():
|
||||
with TemporaryDirectory(prefix="dest") as tmpdir:
|
||||
yield tmpdir
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def src_dir():
|
||||
with TemporaryDirectory(prefix="src") as tmpdir:
|
||||
shutil.copy(AUDIO_FILE, tmpdir)
|
||||
yield tmpdir
|
||||
def src_dir(tmp_path: Path):
|
||||
src = tmp_path / "src"
|
||||
src.mkdir()
|
||||
shutil.copy(AUDIO_FILE, src)
|
||||
yield src
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue