Move testing tracks into data/

And the generate_tracks.py script into tools/

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-07-26 10:57:01 -04:00
parent d985c53c5c
commit e8f9427750
8 changed files with 13 additions and 25 deletions

View File

@ -2,22 +2,10 @@
clean: clean:
find . -type d -name __pycache__ -exec rm -r {} \+ find . -type d -name __pycache__ -exec rm -r {} \+
find trier -type d -name "Test Album" -exec rm -r {} \+ find data/ -type d -name "Test Album" -exec rm -r {} \+
find trier -type d -name "Test Library" -exec rm -r {} \+ find data/ -type d -name "Test Library" -exec rm -r {} \+
.PHONY: trier
trier:
python trier/generate_tracks.py
EMMENTAL_TESTING=1 python -m unittest discover -v
.PHONY: tests .PHONY: tests
tests: tests:
python trier/generate_tracks.py python tools/generate_tracks.py
find `pwd` -name 'test_*.py' -not -path '*/curds/*' -not -path '*/rind/*' -not -path '*test_emmental.py' \ EMMENTAL_TESTING=1 python -m unittest discover -v
| EMMENTAL_TESTING=1 xargs python -m unittest -v
.PHONY:cover
cover:
python trier/generate_tracks.py
EMMENTAL_TESTING=1 coverage run -m unittest discover -v
coverage report -m

View File

@ -11,7 +11,7 @@ import pathlib
import trackdb import trackdb
import unittest import unittest
test_album = pathlib.Path("./trier/Test Album/") test_album = pathlib.Path("./data/Test Album/")
test_track = test_album / "01 - Test Track.ogg" test_track = test_album / "01 - Test Track.ogg"

View File

@ -3,7 +3,7 @@ from . import metadata
import pathlib import pathlib
import unittest import unittest
test_tracks = pathlib.Path("./trier/Test Album") test_tracks = pathlib.Path("./data/Test Album")
track_01 = test_tracks / "01 - Test Track.ogg" track_01 = test_tracks / "01 - Test Track.ogg"
track_02 = test_tracks / "02 - Test {Disc 2}.ogg" track_02 = test_tracks / "02 - Test {Disc 2}.ogg"

View File

@ -7,7 +7,7 @@ import trackdb
import unittest import unittest
main_context = GLib.main_context_default() main_context = GLib.main_context_default()
test_library = pathlib.Path("./trier/Test Library").absolute() test_library = pathlib.Path("./data/Test Library").absolute()
test_artist1 = test_library / "Test Artist 01" test_artist1 = test_library / "Test Artist 01"
class TestLibrarySidebar(unittest.TestCase): class TestLibrarySidebar(unittest.TestCase):

View File

@ -4,7 +4,7 @@ import pathlib
import trackdb import trackdb
import unittest import unittest
test_tracks = pathlib.Path("./trier/Test Album") test_tracks = pathlib.Path("./data/Test Album")
class TestLibraryTag(unittest.TestCase): class TestLibraryTag(unittest.TestCase):
def tearDown(self): def tearDown(self):

View File

@ -6,7 +6,7 @@ import mutagen.id3
import os import os
import subprocess import subprocess
trier = os.path.abspath("trier") data = os.path.abspath("data")
ffmpeg = "ffmpeg -hide_banner -nostdin -f s16le -i /dev/zero -codec libvorbis -loglevel warning".split() ffmpeg = "ffmpeg -hide_banner -nostdin -f s16le -i /dev/zero -codec libvorbis -loglevel warning".split()
image = mutagen.flac.Picture() image = mutagen.flac.Picture()
@ -21,7 +21,7 @@ image_data = encoded_data.decode("ascii")
def generate_track(length, filename, tags={}): def generate_track(length, filename, tags={}):
path = os.path.join(trier, filename) path = os.path.join(data, filename)
if os.path.exists(path): if os.path.exists(path):
return return
os.makedirs(os.path.dirname(path), exist_ok=True) os.makedirs(os.path.dirname(path), exist_ok=True)
@ -74,7 +74,7 @@ generate_track(60, "Test Album/11 - Test Track 11.ogg", { "Title" : "Test Track
"album" : "Test Album 11", "album" : "Test Album 11",
"discnumber" : "1", "discnumber" : "1",
"tracknumber" : "11" }) "tracknumber" : "11" })
with open(os.path.join(trier, "Test Album/text.txt"), 'w') as f: with open(os.path.join(data, "Test Album/text.txt"), 'w') as f:
f.write("Test Text") f.write("Test Text")
# Create a giant library for testing # Create a giant library for testing

View File

@ -5,7 +5,7 @@ import pathlib
import threading import threading
import unittest import unittest
test_tracks = pathlib.Path("./trier/Test Album") test_tracks = pathlib.Path("./data/Test Album")
class FakeLibrary: class FakeLibrary:
def __init__(self): def __init__(self):

View File

@ -7,7 +7,7 @@ import datetime
import pathlib import pathlib
import unittest import unittest
test_tracks = pathlib.Path("./trier/Test Album") test_tracks = pathlib.Path("./data/Test Album")
class FakeLibrary: class FakeLibrary:
def __init__(self): def __init__(self):