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
50e3ba6e
Commit
50e3ba6e
authored
May 17, 2018
by
Jeremy Bowman
Committed by
GitHub
May 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1368 from jmbowman/jmbowman/no_network_in_tests
Don't require network in tests
parents
4166bc90
c608faf8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
47 deletions
+20
-47
changelog.d/1368.misc.rst
changelog.d/1368.misc.rst
+1
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+19
-47
No files found.
changelog.d/1368.misc.rst
0 → 100644
View file @
50e3ba6e
Fixed tests which failed without network connectivity.
setuptools/tests/test_egg_info.py
View file @
50e3ba6e
...
...
@@ -128,11 +128,11 @@ class TestEggInfo(object):
self
.
_validate_content_order
(
content
,
expected_order
)
def
test_e
gg_base_installed_egg_info
(
self
,
tmpdir_cwd
,
env
):
def
test_e
xpected_files_produced
(
self
,
tmpdir_cwd
,
env
):
self
.
_create_project
()
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
)
actual
=
self
.
_find_egg_info_files
(
env
.
paths
[
'lib'
]
)
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
)
actual
=
os
.
listdir
(
'foo.egg-info'
)
expected
=
[
'PKG-INFO'
,
...
...
@@ -154,8 +154,8 @@ class TestEggInfo(object):
'usage.rst'
:
"Run 'hi'"
,
}
})
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
)
egg_info_dir
=
self
.
_find_egg_info_files
(
env
.
paths
[
'lib'
]).
base
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
)
egg_info_dir
=
os
.
path
.
join
(
'.'
,
'foo.egg-info'
)
sources_txt
=
os
.
path
.
join
(
egg_info_dir
,
'SOURCES.txt'
)
with
open
(
sources_txt
)
as
f
:
assert
'docs/usage.rst'
in
f
.
read
().
split
(
'
\
n
'
)
...
...
@@ -233,27 +233,27 @@ class TestEggInfo(object):
'''
install_requires_deterministic
install_requires=["
fake-factory==0.5.2", "pytz
"]
install_requires=["
wheel>=0.5", "pytest
"]
[options]
install_requires =
fake-factory==0.5.2
pyt
z
wheel>=0.5
pyt
est
fake-factory==0.5.2
pyt
z
wheel>=0.5
pyt
est
'''
,
'''
install_requires_ordered
install_requires=["
fake-factory>=1.12.3,!=2.0
"]
install_requires=["
pytest>=3.0.2,!=10.9999
"]
[options]
install_requires =
fake-factory>=1.12.3,!=2.0
pytest>=3.0.2,!=10.9999
fake-factory!=2.0,>=1.12.3
pytest!=10.9999,>=3.0.2
'''
,
'''
...
...
@@ -394,7 +394,7 @@ class TestEggInfo(object):
self
,
tmpdir_cwd
,
env
,
requires
,
use_setup_cfg
,
expected_requires
,
install_cmd_kwargs
):
self
.
_setup_script_with_requires
(
requires
,
use_setup_cfg
)
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
,
**
install_cmd_kwargs
)
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
,
**
install_cmd_kwargs
)
egg_info_dir
=
os
.
path
.
join
(
'.'
,
'foo.egg-info'
)
requires_txt
=
os
.
path
.
join
(
egg_info_dir
,
'requires.txt'
)
if
os
.
path
.
exists
(
requires_txt
):
...
...
@@ -414,14 +414,14 @@ class TestEggInfo(object):
req
=
'install_requires={"fake-factory==0.5.2", "pytz"}'
self
.
_setup_script_with_requires
(
req
)
with
pytest
.
raises
(
AssertionError
):
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
)
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
)
def
test_extras_require_with_invalid_marker
(
self
,
tmpdir_cwd
,
env
):
tmpl
=
'extras_require={{":{marker}": ["barbazquux"]}},'
req
=
tmpl
.
format
(
marker
=
self
.
invalid_marker
)
self
.
_setup_script_with_requires
(
req
)
with
pytest
.
raises
(
AssertionError
):
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
)
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_extras_require_with_invalid_marker_in_req
(
self
,
tmpdir_cwd
,
env
):
...
...
@@ -429,7 +429,7 @@ class TestEggInfo(object):
req
=
tmpl
.
format
(
marker
=
self
.
invalid_marker
)
self
.
_setup_script_with_requires
(
req
)
with
pytest
.
raises
(
AssertionError
):
self
.
_run_
install
_command
(
tmpdir_cwd
,
env
)
self
.
_run_
egg_info
_command
(
tmpdir_cwd
,
env
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_provides_extra
(
self
,
tmpdir_cwd
,
env
):
...
...
@@ -541,15 +541,6 @@ class TestEggInfo(object):
assert
'Requires-Python: >=2.7.12'
in
pkg_info_lines
assert
'Metadata-Version: 1.2'
in
pkg_info_lines
def
test_python_requires_install
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
"""python_requires='>=1.2.3',"""
)
self
.
_run_install_command
(
tmpdir_cwd
,
env
)
egg_info_dir
=
self
.
_find_egg_info_files
(
env
.
paths
[
'lib'
]).
base
pkginfo
=
os
.
path
.
join
(
egg_info_dir
,
'PKG-INFO'
)
with
open
(
pkginfo
)
as
f
:
assert
'Requires-Python: >=1.2.3'
in
f
.
read
().
split
(
'
\
n
'
)
def
test_manifest_maker_warning_suppression
(
self
):
fixtures
=
[
"standard file not found: should have one of foo.py, bar.py"
,
...
...
@@ -559,17 +550,13 @@ class TestEggInfo(object):
for
msg
in
fixtures
:
assert
manifest_maker
.
_should_suppress_warning
(
msg
)
def
_run_
install
_command
(
self
,
tmpdir_cwd
,
env
,
cmd
=
None
,
output
=
None
):
def
_run_
egg_info
_command
(
self
,
tmpdir_cwd
,
env
,
cmd
=
None
,
output
=
None
):
environ
=
os
.
environ
.
copy
().
update
(
HOME
=
env
.
paths
[
'home'
],
)
if
cmd
is
None
:
cmd
=
[
'install'
,
'--home'
,
env
.
paths
[
'home'
],
'--install-lib'
,
env
.
paths
[
'lib'
],
'--install-scripts'
,
env
.
paths
[
'scripts'
],
'--install-data'
,
env
.
paths
[
'data'
],
'egg_info'
,
]
code
,
data
=
environment
.
run_setup_py
(
cmd
=
cmd
,
...
...
@@ -581,18 +568,3 @@ class TestEggInfo(object):
raise
AssertionError
(
data
)
if
output
:
assert
output
in
data
def
_find_egg_info_files
(
self
,
root
):
class
DirList
(
list
):
def
__init__
(
self
,
files
,
base
):
super
(
DirList
,
self
).
__init__
(
files
)
self
.
base
=
base
results
=
(
DirList
(
filenames
,
dirpath
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
root
)
if
os
.
path
.
basename
(
dirpath
)
==
'EGG-INFO'
)
# expect exactly one result
result
,
=
results
return
result
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