Skip to content

Commit

Permalink
fix with python2
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Apr 24, 2018
1 parent dbbcc9f commit a1f146b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
11 changes: 2 additions & 9 deletions sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,15 +600,8 @@ def _get_file_arg(key):
'custom_import_extensions must be a list of strings '
'not {}'.format(type(_custom_exts))
)
custom_import_extensions = []
for ext in _custom_exts:
if isinstance(ext, text_type):
custom_import_extensions.append(ext.encode('utf-8'))
else:
raise TypeError(
'custom_import_extensions must be a list of strings '
'not {}'.format(type(ext))
)
custom_import_extensions = [ext.encode('utf-8') for ext in _custom_exts]

importers = _validate_importers(kwargs.pop('importers', None))

if 'string' in modes:
Expand Down
9 changes: 2 additions & 7 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,19 +1435,14 @@ def test_import_css(exts, tmpdir):
assert out == 'body {\n color: green; }\n'


@pytest.mark.parametrize('exts', [
['.css', 3],
'.css',
[b'.css'],
])
def test_import_css_error(exts, tmpdir):
def test_import_css_error(tmpdir):
tmpdir.join('other.css').write('body {color: green}')
main_scss = tmpdir.join('main.scss')
main_scss.write("@import 'other';")
with pytest.raises(TypeError):
sass.compile(
filename=main_scss.strpath,
custom_import_extensions=exts,
custom_import_extensions='.css',
)


Expand Down

0 comments on commit a1f146b

Please sign in to comment.