Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
511d753c
Unverified
Commit
511d753c
authored
Apr 05, 2020
by
Xavier Francisco
Committed by
GitHub
Apr 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure list access is performed after the length check (#2265)
parent
bf331a54
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
poetry/masonry/utils/package_include.py
+1
-2
tests/masonry/utils/test_package_include.py
+9
-0
No files found.
poetry/masonry/utils/package_include.py
View file @
511d753c
...
...
@@ -34,13 +34,12 @@ class PackageInclude(Include):
return
self
.
check_elements
()
def
check_elements
(
self
):
# type: () -> PackageInclude
root
=
self
.
_elements
[
0
]
if
not
self
.
_elements
:
raise
ValueError
(
"{} does not contain any element"
.
format
(
self
.
_base
/
self
.
_include
)
)
root
=
self
.
_elements
[
0
]
if
len
(
self
.
_elements
)
>
1
:
# Probably glob
self
.
_is_package
=
True
...
...
tests/masonry/utils/test_package_include.py
View file @
511d753c
...
...
@@ -41,3 +41,12 @@ def test_package_include_with_no_python_files_in_dir():
PackageInclude
(
base
=
with_includes
,
include
=
"not_a_python_pkg"
)
assert
str
(
e
.
value
)
==
"not_a_python_pkg is not a package."
def
test_package_include_with_non_existent_directory
():
with
pytest
.
raises
(
ValueError
)
as
e
:
PackageInclude
(
base
=
with_includes
,
include
=
"not_a_dir"
)
err_str
=
str
(
with_includes
/
"not_a_dir"
)
+
" does not contain any element"
assert
str
(
e
.
value
)
==
err_str
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment