diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-27 16:10:10 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-27 16:10:10 -0700 |
commit | a78bb715cab3a9686440a9963b498eeda3aa869b (patch) | |
tree | d67f76f05ca4c2bbaf6800b4e8b3a5062d1d2501 /scss/tests | |
parent | 6dad0e9ed0a651c43564ea71d0a16624cc56a2fd (diff) | |
download | pyscss-a78bb715cab3a9686440a9963b498eeda3aa869b.tar.gz |
Move Compass to an extension.
Diffstat (limited to 'scss/tests')
-rw-r--r-- | scss/tests/functions/compass/test_gradients.py | 6 | ||||
-rw-r--r-- | scss/tests/functions/compass/test_helpers.py | 17 | ||||
-rw-r--r-- | scss/tests/functions/compass/test_images.py | 26 |
3 files changed, 21 insertions, 28 deletions
diff --git a/scss/tests/functions/compass/test_gradients.py b/scss/tests/functions/compass/test_gradients.py index a141740..f93e335 100644 --- a/scss/tests/functions/compass/test_gradients.py +++ b/scss/tests/functions/compass/test_gradients.py @@ -3,7 +3,8 @@ from __future__ import absolute_import from __future__ import unicode_literals from scss.expression import Calculator -from scss.functions.compass.gradients import COMPASS_GRADIENTS_LIBRARY, linear_gradient +from scss.extension.compass.gradients import gradients_namespace +from scss.extension.compass.gradients import linear_gradient from scss.rule import Namespace from scss.types import String, List, Number, Color @@ -12,8 +13,7 @@ import pytest @pytest.fixture def calc(): - ns = Namespace(functions=COMPASS_GRADIENTS_LIBRARY) - return Calculator(ns).evaluate_expression + return Calculator(gradients_namespace).evaluate_expression def test_linear_gradient(): diff --git a/scss/tests/functions/compass/test_helpers.py b/scss/tests/functions/compass/test_helpers.py index a0615aa..bbcaaf0 100644 --- a/scss/tests/functions/compass/test_helpers.py +++ b/scss/tests/functions/compass/test_helpers.py @@ -12,24 +12,21 @@ Ruby code. from __future__ import absolute_import from __future__ import unicode_literals +import os + +from scss import config from scss.expression import Calculator -from scss.functions.compass.helpers import COMPASS_HELPERS_LIBRARY +from scss.extension.compass.helpers import helpers_namespace from scss.rule import Namespace - import pytest -from scss import config -import os -from _pytest.monkeypatch import monkeypatch -xfail = pytest.mark.xfail # TODO many of these tests could also stand to test for failure cases @pytest.fixture def calc(): - ns = Namespace(functions=COMPASS_HELPERS_LIBRARY) - return Calculator(ns).evaluate_expression + return Calculator(helpers_namespace).evaluate_expression # ------------------------------------------------------------------------------ @@ -179,12 +176,12 @@ def test_font_files(calc): # inline-font-files -def test_inline_font_files(calc): +def test_inline_font_files(calc, monkeypatch): """ @author: funvit @note: adapted from compass / test / units / sass_extensions_test.rb """ - monkeypatch().setattr(config, 'FONTS_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/fonts')) + monkeypatch.setattr(config, 'FONTS_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/fonts')) with open(os.path.join(config.PROJECT_ROOT, 'tests/files/fonts/bgrove.base64.txt'), 'r') as f: font_base64 = ''.join((f.readlines())) diff --git a/scss/tests/functions/compass/test_images.py b/scss/tests/functions/compass/test_images.py index 1478fa7..dc1d6e2 100644 --- a/scss/tests/functions/compass/test_images.py +++ b/scss/tests/functions/compass/test_images.py @@ -12,25 +12,21 @@ Ruby code. from __future__ import absolute_import from __future__ import unicode_literals -from scss.expression import Calculator -from scss.functions.compass.images import COMPASS_IMAGES_LIBRARY -from scss.rule import Namespace - +import os +import sys import pytest + from scss import config -import os -import sys -from _pytest.monkeypatch import monkeypatch -xfail = pytest.mark.xfail +from scss.expression import Calculator +from scss.extension.compass.images import images_namespace -# TODO many of these tests could also stand to test for failure cases +# TODO many of these tests could also stand to test for failure cases @pytest.fixture def calc(): - ns = Namespace(functions=COMPASS_IMAGES_LIBRARY) - return Calculator(ns).evaluate_expression + return Calculator(images_namespace).evaluate_expression def test_image_url(calc): @@ -40,8 +36,8 @@ def test_image_url(calc): # inline-image -def test_inline_image(calc): - monkeypatch().setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/images')) +def test_inline_image(calc, monkeypatch): + monkeypatch.setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/images')) with open(os.path.join(config.PROJECT_ROOT, 'tests/files/images/test-qr.base64.txt'), 'r') as f: font_base64 = f.read() @@ -49,8 +45,8 @@ def test_inline_image(calc): @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')) +def test_inline_cursor(calc, monkeypatch): + monkeypatch.setattr(config, 'IMAGES_ROOT', os.path.join(config.PROJECT_ROOT, 'tests/files/cursors')) with open(os.path.join(config.PROJECT_ROOT, 'tests/files/cursors/fake.base64.txt'), 'r') as f: font_base64 = f.read() |