From f56e6764a883e65aa9bbf3c3dc940426bf7609eb Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 15 Feb 2019 16:09:09 -0500 Subject: [PATCH] curds: Clean up unused code I added a make target for code coverage, and used that to identify code that isn't getting run. Signed-off-by: Anna Schumaker --- Makefile | 6 ++++++ curds/test_album.py | 5 ----- curds/test_data.py | 12 ------------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 1256d05..9ebfa25 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,9 @@ clean: trier: python trier/generate_tracks.py EMMENTAL_TESTING=1 python -m unittest discover -v curds/ + +.PHONY:cover +cover: + python trier/generate_tracks.py + EMMENTAL_TESTING=1 coverage run -m unittest discover -v curds/ + coverage report -m diff --git a/curds/test_album.py b/curds/test_album.py index b812812..47a27c3 100644 --- a/curds/test_album.py +++ b/curds/test_album.py @@ -1,5 +1,4 @@ # Copyright 2019 (c) Anna Schumaker -import asyncio import concurrent.futures import hashlib import unittest @@ -64,7 +63,3 @@ class TestAlbumClass(unittest.TestCase): self.assertIsNotNone(res[0]) self.assertEqual(res.count(res[0]), 20) self.assertEqual(len(album.album_map), 1) - - -if __name__ == '__main__': - unittest.main() diff --git a/curds/test_data.py b/curds/test_data.py index c29b925..e8e7dfa 100644 --- a/curds/test_data.py +++ b/curds/test_data.py @@ -7,19 +7,7 @@ import xdg.BaseDirectory xdg_data_home = xdg.BaseDirectory.xdg_data_home testing_data = os.path.join(xdg_data_home, "emmental-testing") -class Test: - def __init__(self): - self.one = 1 - self.two = 2 - self.list = [ 3, 4, 5] - - class TestDataModule(unittest.TestCase): - def setUp(self): - path = os.path.join(testing_data, "test") - if os.path.exists(path): - os.remove(path) - def test_dir(self): self.assertEqual(data.emmental_data, testing_data) self.assertTrue(os.path.exists(testing_data))