diff --git a/test/test_patatools/.gitignore b/test/test_patatools/.gitignore new file mode 100644 index 00000000..16d3c4db --- /dev/null +++ b/test/test_patatools/.gitignore @@ -0,0 +1 @@ +.cache diff --git a/test/test_patatools/__init__.py b/test/test_patatools/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/test_patatools/test_cache.py b/test/test_patatools/test_cache.py new file mode 100644 index 00000000..daa47af1 --- /dev/null +++ b/test/test_patatools/test_cache.py @@ -0,0 +1,41 @@ +"""Tests of the patatools-convert command.""" + +# pylint: disable=too-few-public-methods + +import os +import shutil +import unittest + +from patacrep.tools import convert + +CACHEDIR = os.path.join(os.path.dirname(__file__), "test_cache_datadir", "songs", ".cache") + +class TestCache(unittest.TestCase): + """Test of the "patatools cache" subcommand""" + + def setUp(self): + """Remove cache.""" + self._remove_cache() + + def tearDown(self): + """Remove cache.""" + self._remove_cache() + + def _remove_cache(self): + """Delete cache.""" + shutil.rmtree(CACHEDIR, ignore_errors=True) + + def test_clean(self): + """Test of the "patatools cache clean" subcommand""" + # Cache does not exist + self.assertFalse(os.path.exists(CACHEDIR)) + + # First compilation. Ensure that cache exists afterwards + TODO + self.assertTrue(os.path.exists(CACHEDIR)) + + # Clean cache + TODO + + # Ensure that cache does not exist + self.assertFalse(os.path.exists(CACHEDIR)) diff --git a/test/test_patatools/test_cache.sb b/test/test_patatools/test_cache.sb new file mode 100644 index 00000000..a7f15748 --- /dev/null +++ b/test/test_patatools/test_cache.sb @@ -0,0 +1,3 @@ +{ +"datadir": ["test_cache_datadir"], +} diff --git a/test/test_patatools/test_cache_datadir/songs/foo.csg b/test/test_patatools/test_cache_datadir/songs/foo.csg new file mode 100644 index 00000000..e69de29b diff --git a/test/test_patatools/test_convert.py b/test/test_patatools/test_convert.py new file mode 100644 index 00000000..e69de29b