diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-10-17 14:36:04 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-10-17 14:36:04 -0700 |
commit | cf388579d73f12993eb4a50a7bf11c373eff6c87 (patch) | |
tree | dbeac0b98c160d97cdc60926e0de8a608dd16573 /scss/tests | |
parent | 9f17aef50155ac0d7191cf9596d9664d2b6b53e4 (diff) | |
download | pyscss-cf388579d73f12993eb4a50a7bf11c373eff6c87.tar.gz |
Better handle running the tests without PIL installed.
Diffstat (limited to 'scss/tests')
-rw-r--r-- | scss/tests/functions/compass/test_images.py | 3 | ||||
-rw-r--r-- | scss/tests/functions/test_extra.py | 5 | ||||
-rw-r--r-- | scss/tests/util.py | 15 |
3 files changed, 23 insertions, 0 deletions
diff --git a/scss/tests/functions/compass/test_images.py b/scss/tests/functions/compass/test_images.py index a5d0312..025a32e 100644 --- a/scss/tests/functions/compass/test_images.py +++ b/scss/tests/functions/compass/test_images.py @@ -20,6 +20,7 @@ import pytest from scss import config from scss.calculator import Calculator from scss.extension.compass import CompassExtension +from scss.tests.util import needs_PIL # TODO many of these tests could also stand to test for failure cases @@ -36,6 +37,7 @@ def test_image_url(calc): # inline-image +@needs_PIL def test_inline_image(calc, monkeypatch): monkeypatch.setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/images')) @@ -45,6 +47,7 @@ def test_inline_image(calc, monkeypatch): @pytest.mark.skipif(sys.platform == 'win32', reason='cur mimetype is defined on windows') +@needs_PIL def test_inline_cursor(calc, monkeypatch): monkeypatch.setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/cursors')) diff --git a/scss/tests/functions/test_extra.py b/scss/tests/functions/test_extra.py index 8940e94..d9f97cb 100644 --- a/scss/tests/functions/test_extra.py +++ b/scss/tests/functions/test_extra.py @@ -8,25 +8,30 @@ from __future__ import absolute_import from __future__ import unicode_literals import scss.extension.extra as libextra +from scss.tests.util import needs_PIL from scss.types import Boolean, Color, Number # TODO: currently these all just call the functions and make sure they pass. # would be nice to check the output, though that's a little tedious. +@needs_PIL def test_background_noise(): libextra.background_noise(Number(0.5), Number(0.5), Number(100), Boolean(True), color=Color.from_name('green')) +@needs_PIL def test_background_brushed(): libextra.background_brushed(Number(0.5), Number(0.5), Color.from_name('red'), Number(0.5)) +@needs_PIL def test_grid_image(): # TODO this should accept sass values only :| libextra.grid_image(5, 100, 5, 100) +@needs_PIL def test_image_color(): libextra.image_color(Color.from_rgb(1, 1, 0)) assert True diff --git a/scss/tests/util.py b/scss/tests/util.py new file mode 100644 index 0000000..8b36d7d --- /dev/null +++ b/scss/tests/util.py @@ -0,0 +1,15 @@ +"""Test utilities.""" +from __future__ import absolute_import + +import pytest + +try: + import PIL +except ImportError: + try: + import Image as PIL + except ImportError: + PIL = None + + +needs_PIL = pytest.mark.skipif(PIL is None, reason='image tests require PIL') |