Skip to content

Commit

Permalink
Fix incorrect exception for bad paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Vergeev committed Apr 30, 2018
1 parent a9aed94 commit cb7a723
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fiasko_bro/repository_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def is_tracked_directory(self, directory):
class ProjectFolder:

def __init__(self, path, directories_to_skip=None):
if not os.path.isdir(path):
raise FileNotFoundError('Path "{}" not found or is not a directory.'.format(path))
self.path = path
self._parsed_py_files = self._get_parsed_py_files(directories_to_skip)
try:
Expand Down
17 changes: 17 additions & 0 deletions tests/test_validation_interface/test_incorrect_input_handled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os.path

import pytest

from fiasko_bro import validate


@pytest.fixture(scope='session')
def non_existent_directory():
directory = 'test_fixtures{}directory_that_should_not_exist'.format(os.path.sep)
assert not os.path.isdir(directory)
return directory


def test_not_existing_file_raises_correct_exception(non_existent_directory):
with pytest.raises(FileNotFoundError):
validate(non_existent_directory)

0 comments on commit cb7a723

Please sign in to comment.