-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…1592) * Handle nested wildcards in package includes correctly. Fixes: #1379. Use compat `Path`. * Ensure that when building sdists, subpackages with Python files (but not necessarily an __init__.py file) will be included.
- Loading branch information
Showing
12 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
|
||
from poetry.masonry.utils.package_include import PackageInclude | ||
from poetry.utils._compat import Path | ||
|
||
|
||
fixtures_dir = Path(__file__).parent / "fixtures" | ||
with_includes = fixtures_dir / "with_includes" | ||
|
||
|
||
def test_package_include_with_multiple_dirs(): | ||
pkg_include = PackageInclude(base=fixtures_dir, include="with_includes") | ||
assert pkg_include.elements == [ | ||
with_includes / "__init__.py", | ||
with_includes / "bar", | ||
with_includes / "bar/baz.py", | ||
with_includes / "extra_package", | ||
with_includes / "extra_package/some_dir", | ||
with_includes / "extra_package/some_dir/foo.py", | ||
with_includes / "extra_package/some_dir/quux.py", | ||
with_includes / "not_a_python_pkg", | ||
with_includes / "not_a_python_pkg/baz.txt", | ||
] | ||
|
||
|
||
def test_package_include_with_simple_dir(): | ||
pkg_include = PackageInclude(base=with_includes, include="bar") | ||
assert pkg_include.elements == [with_includes / "bar/baz.py"] | ||
|
||
|
||
def test_package_include_with_nested_dir(): | ||
pkg_include = PackageInclude(base=with_includes, include="extra_package/**/*.py") | ||
assert pkg_include.elements == [ | ||
with_includes / "extra_package/some_dir/foo.py", | ||
with_includes / "extra_package/some_dir/quux.py", | ||
] | ||
|
||
|
||
def test_package_include_with_no_python_files_in_dir(): | ||
with pytest.raises(ValueError) as e: | ||
PackageInclude(base=with_includes, include="not_a_python_pkg") | ||
|
||
assert str(e.value) == "not_a_python_pkg is not a package." |