diff options
-rw-r--r-- | scss/functions/compass/sprites.py | 5 | ||||
-rw-r--r-- | scss/tests/functions/compass/test_images.py | 2 | ||||
-rw-r--r-- | scss/util.py | 2 | ||||
-rw-r--r-- | tox.ini | 12 |
4 files changed, 18 insertions, 3 deletions
diff --git a/scss/functions/compass/sprites.py b/scss/functions/compass/sprites.py index ca70ccd..908adcd 100644 --- a/scss/functions/compass/sprites.py +++ b/scss/functions/compass/sprites.py @@ -13,6 +13,7 @@ import logging import os.path import tempfile import time +import sys try: import cPickle as pickle @@ -398,6 +399,10 @@ def sprite_map(g, **kwargs): cache_tmp = tempfile.NamedTemporaryFile(delete=False, dir=ASSETS_ROOT) pickle.dump((now_time, file_asset, inline_asset, sprite_map, sizes), cache_tmp) cache_tmp.close() + if sys.platform == 'win32' and os.path.isfile(cache_path): + # on windows, cannot rename a file to a path that matches + # an existing file, we have to remove it first + os.remove(cache_path) os.rename(cache_tmp.name, cache_path) # Use the sorted list to remove older elements (keep only 500 objects): diff --git a/scss/tests/functions/compass/test_images.py b/scss/tests/functions/compass/test_images.py index 874d3da..1478fa7 100644 --- a/scss/tests/functions/compass/test_images.py +++ b/scss/tests/functions/compass/test_images.py @@ -48,7 +48,7 @@ def test_inline_image(calc): assert 'url(data:image/png;base64,%s)' % font_base64 == calc('inline_image("/test-qr.png")').render() -@pytest.mark.skipif(sys.platform=='win32', reason='cur mimetype is defined on windows') +@pytest.mark.skipif(sys.platform == 'win32', reason='cur mimetype is defined on windows') def test_inline_cursor(calc): monkeypatch().setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/cursors')) diff --git a/scss/util.py b/scss/util.py index 9c1a869..481a0c0 100644 --- a/scss/util.py +++ b/scss/util.py @@ -113,7 +113,7 @@ def make_filename_hash(key): # the expected test results if sys.platform == 'win32': # this is to make sure the hash is the same on win and unix platforms - key_repr = key_repr.replace('\\\\', '/') + key_repr = key_repr.replace(b'\\\\', b'/') key_repr = re.sub(b"\\bu'", b"'", key_repr) key_hash = hashlib.md5(key_repr).digest() return base64.b64encode(key_hash, b'__').decode('ascii').rstrip('=') @@ -1,5 +1,5 @@ [tox] -envlist = py27 +envlist = py27, py32, py33, py34 [testenv] # fontforge bindings cannot be installed from pip, so they may only be @@ -18,3 +18,13 @@ commands = {toxworkdir}/{envname}/Scripts/py.test [] deps = {[testenv]deps} enum34 + +[testenv:py32] +deps = + {[testenv]deps} + enum34 + +[testenv:py33] +deps = + {[testenv]deps} + enum34 |