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
20413e81
Commit
20413e81
authored
Feb 03, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract ns_str as class attribute
parent
a9a38182
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+5
-5
No files found.
pkg_resources/tests/test_resources.py
View file @
20413e81
...
...
@@ -610,6 +610,8 @@ class TestParsing:
class
TestNamespaces
:
ns_str
=
"__import__('pkg_resources').declare_namespace(__name__)
\
n
"
@
pytest
.
yield_fixture
def
symlinked_tmpdir
(
self
,
tmpdir
):
"""
...
...
@@ -657,13 +659,12 @@ class TestNamespaces:
tmpdir
=
symlinked_tmpdir
sys
.
path
.
append
(
str
(
tmpdir
/
'site-pkgs2'
))
site_dirs
=
tmpdir
/
'site-pkgs'
,
tmpdir
/
'site-pkgs2'
ns_str
=
"__import__('pkg_resources').declare_namespace(__name__)
\
n
"
for
site
in
site_dirs
:
pkg1
=
site
/
'pkg1'
pkg2
=
pkg1
/
'pkg2'
pkg2
.
ensure_dir
()
(
pkg1
/
'__init__.py'
).
write_text
(
ns_str
,
encoding
=
'utf-8'
)
(
pkg2
/
'__init__.py'
).
write_text
(
ns_str
,
encoding
=
'utf-8'
)
(
pkg1
/
'__init__.py'
).
write_text
(
self
.
ns_str
,
encoding
=
'utf-8'
)
(
pkg2
/
'__init__.py'
).
write_text
(
self
.
ns_str
,
encoding
=
'utf-8'
)
import
pkg1
assert
"pkg1"
in
pkg_resources
.
_namespace_packages
# attempt to import pkg2 from site-pkgs2
...
...
@@ -695,7 +696,6 @@ class TestNamespaces:
tmpdir
/
"site-pkgs3"
,
)
ns_str
=
"__import__('pkg_resources').declare_namespace(__name__)
\
n
"
vers_str
=
"__version__ = %r"
for
number
,
site
in
enumerate
(
site_dirs
,
1
):
...
...
@@ -704,7 +704,7 @@ class TestNamespaces:
nspkg
=
site
/
'nspkg'
subpkg
=
nspkg
/
'subpkg'
subpkg
.
ensure_dir
()
(
nspkg
/
'__init__.py'
).
write_text
(
ns_str
,
encoding
=
'utf-8'
)
(
nspkg
/
'__init__.py'
).
write_text
(
self
.
ns_str
,
encoding
=
'utf-8'
)
(
subpkg
/
'__init__.py'
).
write_text
(
vers_str
%
number
,
encoding
=
'utf-8'
)
import
nspkg.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