Add a toplevel script

I'll eventually need to be able to run everything as a single
application, so let's prepare for that now. This gives us a chance to
get the imports right from the start, rather than needing to go through
and fix things up again.

I also add a test to make sure everything works as expected.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-03-06 08:41:51 -05:00
parent 5908a8af50
commit 2057721028
10 changed files with 29 additions and 15 deletions

View File

@ -8,10 +8,10 @@ clean:
.PHONY: trier
trier:
python trier/generate_tracks.py
EMMENTAL_TESTING=1 python -m unittest discover -v curds/
EMMENTAL_TESTING=1 python -m unittest discover -v
.PHONY:cover
cover:
python trier/generate_tracks.py
EMMENTAL_TESTING=1 coverage run -m unittest discover -v curds/
EMMENTAL_TESTING=1 coverage run -m unittest discover -v
coverage report -m

1
curds/__init__.py Normal file
View File

@ -0,0 +1 @@
# Copyright 2019 (c) Anna Schumaker.

View File

@ -1,5 +1,5 @@
# Copyright 2019 (c) Anna Schumaker.
import data
from . import data
import mutagen
import os
import re

View File

@ -1,5 +1,5 @@
# Copyright 2019 (c) Anna Schumaker.
import data
from . import data
import os
import unittest
import xdg.BaseDirectory

View File

@ -1,7 +1,7 @@
# Copyright 2019 (c) Anna Schumaker.
import data
import tags
import threadqueue
from . import data
from . import tags
from . import threadqueue
import unittest
import os
@ -34,11 +34,10 @@ class TestTags(unittest.TestCase):
self.assertTrue(hash(t.album) in tags.tag_map)
def test_tags_stress(self):
dfile = data.DataFile("tags.pickle", data.READ)
tq = threadqueue.ThreadQueue()
tracks = 0
albums = 0
tag_list = list(tags.tag_map)
dfile = data.DataFile("tags.pickle", data.READ)
tq = threadqueue.ThreadQueue()
tracks = 0
albums = 0
self.assertFalse(dfile.exists())
@ -57,6 +56,7 @@ class TestTags(unittest.TestCase):
tq.stop()
self.assertEqual(len(tags.tag_map), tracks + albums)
self.assertTrue(dfile.exists())
tag_list = list(tags.tag_map.values())
tags.tag_map.clear()
tags.load()

View File

@ -1,5 +1,5 @@
# Copyright 2019 (c) Anna Schumaker.
import tags
from . import tags
import unittest
album_info = {"album" : [ "Test Album" ], "albumartist" : [ "Test Artist" ],

View File

@ -1,6 +1,6 @@
# Copyright 2019 (c) Anna Schumaker.
from . import tags
import os
import tags
import unittest
test_tracks = os.path.abspath("./trier/Test Album")

View File

@ -1,8 +1,8 @@
# Copyright 2019 (c) Anna Schumaker.
from . import threadqueue
import queue
import unittest
import threading
import threadqueue
test_a = 0
test_b = 0

3
emmental.py Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/python
# Copyright 2019 (c) Anna Schumaker.
import curds

10
test_emmental.py Normal file
View File

@ -0,0 +1,10 @@
# Copyright 2019 (c) Anna Schumaker.
import curds
import unittest
class TestEmmental(unittest.TestCase):
def test_import_curds(self):
self.assertIsNotNone(curds)
self.assertIsNotNone(curds.data)
self.assertIsNotNone(curds.tags)
self.assertIsNotNone(curds.threadqueue)