From bd94153bc4892f282287b0bf828572b63472db05 Mon Sep 17 00:00:00 2001 From: Louis Date: Sat, 16 Jan 2016 23:34:43 +0100 Subject: [PATCH] [WIP] Test of patatools commands --- test/test_patatools/.gitignore | 1 + test/test_patatools/__init__.py | 0 test/test_patatools/test_cache.py | 41 +++++++++++++++++++ test/test_patatools/test_cache.sb | 3 ++ .../test_cache_datadir/songs/foo.csg | 0 test/test_patatools/test_convert.py | 0 6 files changed, 45 insertions(+) create mode 100644 test/test_patatools/.gitignore create mode 100644 test/test_patatools/__init__.py create mode 100644 test/test_patatools/test_cache.py create mode 100644 test/test_patatools/test_cache.sb create mode 100644 test/test_patatools/test_cache_datadir/songs/foo.csg create mode 100644 test/test_patatools/test_convert.py 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