Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
d8f8de7f
Commit
d8f8de7f
authored
Jul 04, 2018
by
Carsten Klein
Committed by
Paul Ganssle
Jul 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for find_packages_ns()
parent
244ff322
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+16
-10
No files found.
setuptools/tests/test_find_packages.py
View file @
d8f8de7f
...
@@ -7,14 +7,15 @@ import platform
...
@@ -7,14 +7,15 @@ import platform
import
pytest
import
pytest
import
setuptools
from
setuptools.extern.six
import
PY3
from
setuptools
import
find_packages
from
setuptools
import
find_packages
find_420_packages
=
setuptools
.
PEP420PackageFinder
.
find
py3_only
=
pytest
.
mark
.
xfail
(
not
PY3
,
reason
=
"Test runs on Python 3 only"
)
if
PY3
:
from
setuptools
import
find_packages_ns
# modeled after CPython's test.support.can_symlink
# modeled after CPython's test.support.can_symlink
def
can_symlink
():
def
can_symlink
():
TESTFN
=
tempfile
.
mktemp
()
TESTFN
=
tempfile
.
mktemp
()
symlink_path
=
TESTFN
+
"can_symlink"
symlink_path
=
TESTFN
+
"can_symlink"
...
@@ -153,30 +154,35 @@ class TestFindPackages:
...
@@ -153,30 +154,35 @@ class TestFindPackages:
def
_assert_packages
(
self
,
actual
,
expected
):
def
_assert_packages
(
self
,
actual
,
expected
):
assert
set
(
actual
)
==
set
(
expected
)
assert
set
(
actual
)
==
set
(
expected
)
@
py3_only
def
test_pep420_ns_package
(
self
):
def
test_pep420_ns_package
(
self
):
packages
=
find_
420_package
s
(
packages
=
find_
packages_n
s
(
self
.
dist_dir
,
include
=
[
'pkg*'
],
exclude
=
[
'pkg.subpkg.assets'
])
self
.
dist_dir
,
include
=
[
'pkg*'
],
exclude
=
[
'pkg.subpkg.assets'
])
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
@
py3_only
def
test_pep420_ns_package_no_includes
(
self
):
def
test_pep420_ns_package_no_includes
(
self
):
packages
=
find_
420_package
s
(
packages
=
find_
packages_n
s
(
self
.
dist_dir
,
exclude
=
[
'pkg.subpkg.assets'
])
self
.
dist_dir
,
exclude
=
[
'pkg.subpkg.assets'
])
self
.
_assert_packages
(
packages
,
[
'docs'
,
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
self
.
_assert_packages
(
packages
,
[
'docs'
,
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
@
py3_only
def
test_pep420_ns_package_no_includes_or_excludes
(
self
):
def
test_pep420_ns_package_no_includes_or_excludes
(
self
):
packages
=
find_420_packages
(
self
.
dist_dir
)
packages
=
find_packages_ns
(
self
.
dist_dir
)
expected
=
[
expected
=
[
'docs'
,
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
,
'pkg.subpkg.assets'
]
'docs'
,
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
,
'pkg.subpkg.assets'
]
self
.
_assert_packages
(
packages
,
expected
)
self
.
_assert_packages
(
packages
,
expected
)
@
py3_only
def
test_regular_package_with_nested_pep420_ns_packages
(
self
):
def
test_regular_package_with_nested_pep420_ns_packages
(
self
):
self
.
_touch
(
'__init__.py'
,
self
.
pkg_dir
)
self
.
_touch
(
'__init__.py'
,
self
.
pkg_dir
)
packages
=
find_
420_package
s
(
packages
=
find_
packages_n
s
(
self
.
dist_dir
,
exclude
=
[
'docs'
,
'pkg.subpkg.assets'
])
self
.
dist_dir
,
exclude
=
[
'docs'
,
'pkg.subpkg.assets'
])
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
@
py3_only
def
test_pep420_ns_package_no_non_package_dirs
(
self
):
def
test_pep420_ns_package_no_non_package_dirs
(
self
):
shutil
.
rmtree
(
self
.
docs_dir
)
shutil
.
rmtree
(
self
.
docs_dir
)
shutil
.
rmtree
(
os
.
path
.
join
(
self
.
dist_dir
,
'pkg/subpkg/assets'
))
shutil
.
rmtree
(
os
.
path
.
join
(
self
.
dist_dir
,
'pkg/subpkg/assets'
))
packages
=
find_
420_package
s
(
self
.
dist_dir
)
packages
=
find_
packages_n
s
(
self
.
dist_dir
)
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
self
.
_assert_packages
(
packages
,
[
'pkg'
,
'pkg.nspkg'
,
'pkg.subpkg'
])
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