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
f2bb3b0a
Commit
f2bb3b0a
authored
Feb 12, 2014
by
Wyatt Lee Baldwin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests for find_packages
--HG-- extra : rebase_source : 75f5ce4d2fb9d0ccd7168739c23d9ea1eeeb9112
parent
9fb3ebb7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
setuptools/tests/test_find_packages.py
setuptools/tests/test_find_packages.py
+72
-0
No files found.
setuptools/tests/test_find_packages.py
0 → 100644
View file @
f2bb3b0a
"""Tests for setuptools.find_packages()."""
import
os
import
shutil
import
tempfile
import
unittest
from
setuptools
import
find_packages
class
TestFindPackages
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
dist_dir
=
tempfile
.
mkdtemp
()
self
.
_make_pkg_structure
()
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
dist_dir
)
def
_make_pkg_structure
(
self
):
"""Make basic package structure.
dist/
docs/
conf.py
pkg/
__pycache__/
nspkg/
mod.py
subpkg/
assets/
asset
__init__.py
setup.py
"""
self
.
docs_dir
=
self
.
_mkdir
(
'docs'
,
self
.
dist_dir
)
self
.
_touch
(
'conf.py'
,
self
.
docs_dir
)
self
.
pkg_dir
=
self
.
_mkdir
(
'pkg'
,
self
.
dist_dir
)
self
.
_mkdir
(
'__pycache__'
,
self
.
pkg_dir
)
self
.
ns_pkg_dir
=
self
.
_mkdir
(
'nspkg'
,
self
.
pkg_dir
)
self
.
_touch
(
'mod.py'
,
self
.
ns_pkg_dir
)
self
.
sub_pkg_dir
=
self
.
_mkdir
(
'subpkg'
,
self
.
pkg_dir
)
self
.
asset_dir
=
self
.
_mkdir
(
'assets'
,
self
.
sub_pkg_dir
)
self
.
_touch
(
'asset'
,
self
.
asset_dir
)
self
.
_touch
(
'__init__.py'
,
self
.
sub_pkg_dir
)
self
.
_touch
(
'setup.py'
,
self
.
dist_dir
)
def
_mkdir
(
self
,
path
,
parent_dir
=
None
):
if
parent_dir
:
path
=
os
.
path
.
join
(
parent_dir
,
path
)
os
.
mkdir
(
path
)
return
path
def
_touch
(
self
,
path
,
dir_
=
None
):
if
dir_
:
path
=
os
.
path
.
join
(
dir_
,
path
)
fp
=
open
(
path
,
'w'
)
fp
.
close
()
return
path
def
test_regular_package
(
self
):
self
.
_touch
(
'__init__.py'
,
self
.
pkg_dir
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertEqual
(
packages
,
[
'pkg'
,
'pkg.subpkg'
])
def
test_dir_with_dot_is_skipped
(
self
):
shutil
.
rmtree
(
os
.
path
.
join
(
self
.
dist_dir
,
'pkg/subpkg/assets'
))
data_dir
=
self
.
_mkdir
(
'some.data'
,
self
.
pkg_dir
)
self
.
_touch
(
'__init__.py'
,
data_dir
)
self
.
_touch
(
'file.dat'
,
data_dir
)
packages
=
find_packages
(
self
.
dist_dir
)
self
.
assertNotIn
(
'pkg.some.data'
,
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