File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,12 @@ def refresh(self): # type: () -> PackageInclude
34
34
return self .check_elements ()
35
35
36
36
def check_elements (self ): # type: () -> PackageInclude
37
- root = self ._elements [0 ]
38
-
39
37
if not self ._elements :
40
38
raise ValueError (
41
39
"{} does not contain any element" .format (self ._base / self ._include )
42
40
)
43
41
42
+ root = self ._elements [0 ]
44
43
if len (self ._elements ) > 1 :
45
44
# Probably glob
46
45
self ._is_package = True
Original file line number Diff line number Diff line change @@ -41,3 +41,12 @@ def test_package_include_with_no_python_files_in_dir():
41
41
PackageInclude (base = with_includes , include = "not_a_python_pkg" )
42
42
43
43
assert str (e .value ) == "not_a_python_pkg is not a package."
44
+
45
+
46
+ def test_package_include_with_non_existent_directory ():
47
+ with pytest .raises (ValueError ) as e :
48
+ PackageInclude (base = with_includes , include = "not_a_dir" )
49
+
50
+ err_str = str (with_includes / "not_a_dir" ) + " does not contain any element"
51
+
52
+ assert str (e .value ) == err_str
You can’t perform that action at this time.
0 commit comments