summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-10-17 14:36:04 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-10-17 14:36:04 -0700
commitcf388579d73f12993eb4a50a7bf11c373eff6c87 (patch)
treedbeac0b98c160d97cdc60926e0de8a608dd16573 /conftest.py
parent9f17aef50155ac0d7191cf9596d9664d2b6b53e4 (diff)
downloadpyscss-cf388579d73f12993eb4a50a7bf11c373eff6c87.tar.gz
Better handle running the tests without PIL installed.
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/conftest.py b/conftest.py
index e4371a3..535bb68 100644
--- a/conftest.py
+++ b/conftest.py
@@ -11,6 +11,8 @@ import pytest
import scss
from scss.compiler import compile_file
import scss.config
+from scss.errors import SassEvaluationError
+from scss.errors import SassMissingDependency
from scss.extension.core import CoreExtension
from scss.extension.extra import ExtraExtension
from scss.extension.fonts import FontsExtension
@@ -115,17 +117,27 @@ class SassItem(pytest.Item):
search_path.append(include)
search_path.append(scss_file.parent)
- actual = compile_file(
- scss_file,
- output_style='expanded',
- search_path=search_path,
- extensions=[
- CoreExtension,
- ExtraExtension,
- FontsExtension,
- CompassExtension,
- ],
- )
+ try:
+ actual = compile_file(
+ scss_file,
+ output_style='expanded',
+ search_path=search_path,
+ extensions=[
+ CoreExtension,
+ ExtraExtension,
+ FontsExtension,
+ CompassExtension,
+ ],
+ )
+ except SassEvaluationError as e:
+ # Treat any missing dependencies (PIL not installed, fontforge not
+ # installed) as skips
+ # TODO this is slightly cumbersome and sorta defeats the purpose of
+ # having separate exceptions
+ if isinstance(e.exc, SassMissingDependency):
+ pytest.skip(e.format_message())
+ else:
+ raise
# Normalize leading and trailing newlines
actual = actual.strip('\n')