Skip to content

Commit ae0f92e

Browse files
committed
Merge pull request #119 from asottile/raise_on_no_input_directory
Error when source directory does not exist. Resolves #116.
2 parents f6e4378 + 111b6e6 commit ae0f92e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

sass.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,16 @@ def _to_importer(priority, func):
195195
return tuple(_to_importer(priority, func) for priority, func in importers)
196196

197197

198+
def _raise(e):
199+
raise e
200+
201+
198202
def compile_dirname(
199203
search_path, output_path, output_style, source_comments, include_paths,
200204
precision, custom_functions, importers
201205
):
202206
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
203-
for dirpath, _, filenames in os.walk(search_path):
207+
for dirpath, _, filenames in os.walk(search_path, onerror=_raise):
204208
filenames = [
205209
filename for filename in filenames
206210
if filename.endswith(('.scss', '.sass')) and

sasstests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,10 @@ def write_file(filename, contents):
847847

848848
class CompileDirectoriesTest(unittest.TestCase):
849849

850+
def test_directory_does_not_exist(self):
851+
with pytest.raises(OSError):
852+
sass.compile(dirname=('i_dont_exist_lol', 'out'))
853+
850854
def test_successful(self):
851855
with tempdir() as tmpdir:
852856
input_dir = os.path.join(tmpdir, 'input')

0 commit comments

Comments
 (0)