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
8fdf7763
Commit
8fdf7763
authored
Jan 02, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update test_find_packages to use pytest
parent
08bac0ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+9
-10
No files found.
setuptools/tests/test_find_packages.py
View file @
8fdf7763
...
...
@@ -3,7 +3,6 @@ import os
import
sys
import
shutil
import
tempfile
import
unittest
import
platform
import
pytest
...
...
@@ -34,13 +33,13 @@ def has_symlink():
)
return
can_symlink
()
and
not
bad_symlink
class
TestFindPackages
(
unittest
.
TestCase
)
:
class
TestFindPackages
:
def
set
Up
(
self
):
def
set
up_method
(
self
,
method
):
self
.
dist_dir
=
tempfile
.
mkdtemp
()
self
.
_make_pkg_structure
()
def
tear
Down
(
self
):
def
tear
down_method
(
self
,
method
):
shutil
.
rmtree
(
self
.
dist_dir
)
def
_make_pkg_structure
(
self
):
...
...
@@ -88,7 +87,7 @@ class TestFindPackages(unittest.TestCase):
def
test_regular_package
(
self
):
self
.
_touch
(
'__init__.py'
,
self
.
pkg_dir
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertEqual
(
packages
,
[
'pkg'
,
'pkg.subpkg'
])
assert
packages
==
[
'pkg'
,
'pkg.subpkg'
]
def
test_exclude
(
self
):
self
.
_touch
(
'__init__.py'
,
self
.
pkg_dir
)
...
...
@@ -103,7 +102,7 @@ class TestFindPackages(unittest.TestCase):
alt_dir
=
self
.
_mkdir
(
'other_pkg'
,
self
.
dist_dir
)
self
.
_touch
(
'__init__.py'
,
alt_dir
)
packages
=
find_packages
(
self
.
dist_dir
,
include
=
[
'other_pkg'
])
self
.
assertEqual
(
packages
,
[
'other_pkg'
])
assert
packages
==
[
'other_pkg'
]
def
test_dir_with_dot_is_skipped
(
self
):
shutil
.
rmtree
(
os
.
path
.
join
(
self
.
dist_dir
,
'pkg/subpkg/assets'
))
...
...
@@ -111,7 +110,7 @@ class TestFindPackages(unittest.TestCase):
self
.
_touch
(
'__init__.py'
,
data_dir
)
self
.
_touch
(
'file.dat'
,
data_dir
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertTrue
(
'pkg.some.data'
not
in
packages
)
assert
'pkg.some.data'
not
in
packages
def
test_dir_with_packages_in_subdir_is_excluded
(
self
):
"""
...
...
@@ -122,7 +121,7 @@ class TestFindPackages(unittest.TestCase):
build_pkg_dir
=
self
.
_mkdir
(
'pkg'
,
build_dir
)
self
.
_touch
(
'__init__.py'
,
build_pkg_dir
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertTrue
(
'build.pkg'
not
in
packages
)
assert
'build.pkg'
not
in
packages
@
pytest
.
mark
.
skipif
(
not
has_symlink
(),
reason
=
'Symlink support required'
)
def
test_symlinked_packages_are_included
(
self
):
...
...
@@ -137,10 +136,10 @@ class TestFindPackages(unittest.TestCase):
os
.
symlink
(
'pkg'
,
linked_pkg
)
assert
os
.
path
.
isdir
(
linked_pkg
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertTrue
(
'lpkg'
in
packages
)
assert
'lpkg'
in
packages
def
_assert_packages
(
self
,
actual
,
expected
):
self
.
assertEqual
(
set
(
actual
),
set
(
expected
)
)
assert
set
(
actual
)
==
set
(
expected
)
def
test_pep420_ns_package
(
self
):
packages
=
find_420_packages
(
...
...
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