diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-28 14:00:49 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-28 14:02:34 -0700 |
commit | 756c83a3cfe5945944e96ced216ba8578ca257e5 (patch) | |
tree | 11df0a397bfe245e44f9b4eba1ff6bdb18f21490 /conftest.py | |
parent | 5ae0fffc030353e697acbd26e6145364afc9ffc8 (diff) | |
download | pyscss-756c83a3cfe5945944e96ced216ba8578ca257e5.tar.gz |
Add some helpers for doing simple compilations.
Port the file tests and the "xfail" missing import test to use them.
Also: current directory is no longer in the search path by default,
but compile_file() adds the given file's containing directory.
Diffstat (limited to 'conftest.py')
-rw-r--r-- | conftest.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/conftest.py b/conftest.py index 014b4d8..0a81986 100644 --- a/conftest.py +++ b/conftest.py @@ -8,7 +8,12 @@ import logging import pytest import scss +from scss.compiler import compile_file import scss.config +from scss.extension.core import CoreExtension +from scss.extension.extra import ExtraExtension +from scss.extension.fonts import FontsExtension +from scss.extension.compass import CompassExtension try: import fontforge @@ -97,22 +102,26 @@ class SassItem(pytest.Item): scss_file = self.fspath css_file = scss_file.new(ext='css') - with scss_file.open('rb') as fh: - source = fh.read() with css_file.open('rb') as fh: # Output is Unicode, so decode this here expected = fh.read().decode('utf8') scss.config.STATIC_ROOT = str(scss_file.dirpath('static')) - compiler = scss.Scss( - scss_opts=dict(style='expanded'), - search_paths=[ + actual = compile_file( + str(scss_file), + output_style='expanded', + search_path=[ str(scss_file.dirpath('include')), str(scss_file.dirname), ], + extensions=[ + CoreExtension, + ExtraExtension, + FontsExtension, + CompassExtension, + ], ) - actual = compiler.compile(source) # Normalize leading and trailing newlines actual = actual.strip('\n') |