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
9832db36
Commit
9832db36
authored
Jun 06, 2018
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove crufty, ignored test.
parent
042aab82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
83 deletions
+0
-83
conftest.py
conftest.py
+0
-1
tests/test_pypi.py
tests/test_pypi.py
+0
-82
No files found.
conftest.py
View file @
9832db36
...
...
@@ -13,7 +13,6 @@ def pytest_addoption(parser):
collect_ignore
=
[
'tests/manual_test.py'
,
'tests/test_pypi.py'
,
'pavement.py'
,
'setuptools/tests/mod_with_constant.py'
,
]
...
...
tests/test_pypi.py
deleted
100644 → 0
View file @
042aab82
import
os
import
subprocess
import
virtualenv
from
setuptools.extern.six.moves
import
http_client
from
setuptools.extern.six.moves
import
xmlrpc_client
TOP
=
200
PYPI_HOSTNAME
=
'pypi.python.org'
def
rpc_pypi
(
method
,
*
args
):
"""Call an XML-RPC method on the Pypi server."""
conn
=
http_client
.
HTTPSConnection
(
PYPI_HOSTNAME
)
headers
=
{
'Content-Type'
:
'text/xml'
}
payload
=
xmlrpc_client
.
dumps
(
args
,
method
)
conn
.
request
(
"POST"
,
"/pypi"
,
payload
,
headers
)
response
=
conn
.
getresponse
()
if
response
.
status
==
200
:
result
=
xmlrpc_client
.
loads
(
response
.
read
())[
0
][
0
]
return
result
else
:
raise
RuntimeError
(
"Unable to download the list of top "
"packages from Pypi."
)
def
get_top_packages
(
limit
):
"""Collect the name of the top packages on Pypi."""
packages
=
rpc_pypi
(
'top_packages'
)
return
packages
[:
limit
]
def
_package_install
(
package_name
,
tmp_dir
=
None
,
local_setuptools
=
True
):
"""Try to install a package and return the exit status.
This function creates a virtual environment, install setuptools using pip
and then install the required package. If local_setuptools is True, it
will install the local version of setuptools.
"""
package_dir
=
os
.
path
.
join
(
tmp_dir
,
"test_%s"
%
package_name
)
if
not
local_setuptools
:
package_dir
=
package_dir
+
"_baseline"
virtualenv
.
create_environment
(
package_dir
)
pip_path
=
os
.
path
.
join
(
package_dir
,
"bin"
,
"pip"
)
if
local_setuptools
:
subprocess
.
check_call
([
pip_path
,
"install"
,
"."
])
returncode
=
subprocess
.
call
([
pip_path
,
"install"
,
package_name
])
return
returncode
def
test_package_install
(
package_name
,
tmpdir
):
"""Test to verify the outcome of installing a package.
This test compare that the return code when installing a package is the
same as with the current stable version of setuptools.
"""
new_exit_status
=
_package_install
(
package_name
,
tmp_dir
=
str
(
tmpdir
))
if
new_exit_status
:
print
(
"Installation failed, testing against stable setuptools"
,
package_name
)
old_exit_status
=
_package_install
(
package_name
,
tmp_dir
=
str
(
tmpdir
),
local_setuptools
=
False
)
assert
new_exit_status
==
old_exit_status
def
pytest_generate_tests
(
metafunc
):
"""Generator function for test_package_install.
This function will generate calls to test_package_install. If a package
list has been specified on the command line, it will be used. Otherwise,
Pypi will be queried to get the current list of top packages.
"""
if
"package_name"
in
metafunc
.
fixturenames
:
if
not
metafunc
.
config
.
option
.
package_name
:
packages
=
get_top_packages
(
TOP
)
packages
=
[
name
for
name
,
downloads
in
packages
]
else
:
packages
=
metafunc
.
config
.
option
.
package_name
metafunc
.
parametrize
(
"package_name"
,
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