Skip to content

Error when source directory does not exist. Resolves #116. #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ def _to_importer(priority, func):
return tuple(_to_importer(priority, func) for priority, func in importers)


def _raise(e):
raise e


def compile_dirname(
search_path, output_path, output_style, source_comments, include_paths,
precision, custom_functions, importers
):
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
for dirpath, _, filenames in os.walk(search_path):
for dirpath, _, filenames in os.walk(search_path, onerror=_raise):
filenames = [
filename for filename in filenames
if filename.endswith(('.scss', '.sass')) and
Expand Down
4 changes: 4 additions & 0 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,10 @@ def write_file(filename, contents):

class CompileDirectoriesTest(unittest.TestCase):

def test_directory_does_not_exist(self):
with pytest.raises(OSError):
sass.compile(dirname=('i_dont_exist_lol', 'out'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, use as a context manager of assertRaises() is introduced in Python 2.7. See also py26 build.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah of course, I always forget this /me fixes


def test_successful(self):
with tempdir() as tmpdir:
input_dir = os.path.join(tmpdir, 'input')
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy