summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-10-06 15:03:11 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-10-06 15:03:11 -0700
commitd3366e69c90701d6bf1f53497a2fb8cec8d40c4e (patch)
tree29514a85ee8371777ecb2f537d74c4172d9d0003 /conftest.py
parent6d9c167b53066f3dbfaa179775f2af675fff65f4 (diff)
downloadpyscss-d3366e69c90701d6bf1f53497a2fb8cec8d40c4e.tar.gz
Experiment with porting path handling to use pathlib.
The biggest impetus here is to allow Django integration without having to copy and paste massive piles of code.
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/conftest.py b/conftest.py
index 0a81986..e4371a3 100644
--- a/conftest.py
+++ b/conftest.py
@@ -4,6 +4,7 @@ from __future__ import division
from __future__ import print_function
import logging
+from pathlib import Path
import pytest
@@ -99,22 +100,25 @@ class SassItem(pytest.Item):
excinfo.traceback = excinfo.traceback.cut(__file__)
def runtest(self):
- scss_file = self.fspath
- css_file = scss_file.new(ext='css')
+ scss_file = Path(str(self.fspath))
+ css_file = scss_file.with_suffix('.css')
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'))
+ scss.config.STATIC_ROOT = str(scss_file.parent / 'static')
+
+ search_path = []
+ include = scss_file.parent / 'include'
+ if include.exists():
+ search_path.append(include)
+ search_path.append(scss_file.parent)
actual = compile_file(
- str(scss_file),
+ scss_file,
output_style='expanded',
- search_path=[
- str(scss_file.dirpath('include')),
- str(scss_file.dirname),
- ],
+ search_path=search_path,
extensions=[
CoreExtension,
ExtraExtension,