diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 21:36:58 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 21:36:58 +1000 |
| commit | 06d993bc069ccc3cefeecb2f75f3f64bf8175e22 (patch) | |
| tree | 1b88b13888a88063675f2c727f1803e496891615 /tests/test_colors.py | |
| parent | 5f6de5efe82764c141019e47b488e5def62ca4c2 (diff) | |
tests: Don't rely on test order.
Diffstat (limited to 'tests/test_colors.py')
| -rwxr-xr-x | tests/test_colors.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_colors.py b/tests/test_colors.py index 5765370..ef365ac 100755 --- a/tests/test_colors.py +++ b/tests/test_colors.py @@ -5,9 +5,7 @@ import io import pathlib from pywal import colors - - -CACHE_DIR = pathlib.Path("/tmp/wal") +from pywal import util class TestGenColors(unittest.TestCase): @@ -15,7 +13,7 @@ class TestGenColors(unittest.TestCase): def test_gen_colors(self): """> Generate a colorscheme.""" - result = colors.get("tests/test_files/test.jpg", CACHE_DIR) + result = colors.get("tests/test_files/test.jpg") self.assertEqual(len(result["colors"]["color0"]), 7) def test_gen_colors_fail(self): @@ -25,11 +23,16 @@ class TestGenColors(unittest.TestCase): def test_color_cache(self): """> Test importing a cached scheme.""" + # Create the file to import. + cache_dir = pathlib.Path("/tmp/wal2/") + util.save_file("true", cache_dir / "schemes" + / "tests_test_files_test_jpg.json") + # Since this function just prints a message we redirect # it's output so that we can read it. message = "colors: Found cached colorscheme." with unittest.mock.patch('sys.stdout', new=io.StringIO()) as fake_out: - colors.get("tests/test_files/test.jpg", CACHE_DIR) + colors.get("tests/test_files/test.jpg", cache_dir) self.assertEqual(fake_out.getvalue().strip(), message) def test_color_import(self): |
