summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-24 14:55:14 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2014-08-24 14:55:14 -0700
commit5b50706d09df29979b22319a3109b51c0b5cef7b (patch)
tree786e68e28ef859c89cf1896fed6f6c2b5a830ace
parentb84f9dd233ccb76542d393f531411a28cc14a0c3 (diff)
downloadpyscss-5b50706d09df29979b22319a3109b51c0b5cef7b.tar.gz
Fix a couple oopses on Python 3.
-rw-r--r--scss/compiler.py1
-rw-r--r--scss/source.py2
-rw-r--r--scss/tests/test_files.py15
3 files changed, 11 insertions, 7 deletions
diff --git a/scss/compiler.py b/scss/compiler.py
index 0d0a62f..2394258 100644
--- a/scss/compiler.py
+++ b/scss/compiler.py
@@ -844,6 +844,7 @@ class Compilation(object):
Implements @import for sprite-maps
Imports magic sprite map directories
"""
+ # TODO check that the found file is actually under the root
if callable(config.STATIC_ROOT):
files = sorted(config.STATIC_ROOT(block.argument))
else:
diff --git a/scss/source.py b/scss/source.py
index 8f68819..74a6937 100644
--- a/scss/source.py
+++ b/scss/source.py
@@ -143,7 +143,7 @@ class SourceFile(object):
if path is None:
m = hashlib.sha256()
m.update(byte_contents)
- path = 'string:' + m.hexdigest().decode('ascii')
+ path = 'string:' + m.hexdigest()
elif os.path.exists(path):
path = os.path.normpath(os.path.abspath(path))
is_real_file = True
diff --git a/scss/tests/test_files.py b/scss/tests/test_files.py
index c5df737..6bd39de 100644
--- a/scss/tests/test_files.py
+++ b/scss/tests/test_files.py
@@ -13,9 +13,15 @@ from __future__ import absolute_import, unicode_literals
import os.path
import logging
+import six
+
import scss
+if six.PY2:
+ from codecs import open
+
+
console = logging.StreamHandler()
logger = logging.getLogger('scss')
logger.setLevel(logging.ERROR)
@@ -25,13 +31,10 @@ logger.addHandler(console)
def test_pair_programmatic(scss_file_pair):
scss_fn, css_fn = scss_file_pair
- with open(scss_fn) as fh:
+ with open(scss_fn, 'rb') as fh:
source = fh.read()
- try:
- with open(css_fn) as fh:
- expected = fh.read().decode('utf-8')
- except IOError:
- expected = ''
+ with open(css_fn, 'r', encoding='utf8') as fh:
+ expected = fh.read()
directory, _ = os.path.split(scss_fn)
include_dir = os.path.join(directory, 'include')