forked from github.com/pypiserver
FIX test_server FC!
+ Generate dummy-dists within tests to support running on every platform/py-version. + delete pr-generated dummy-wheels. + Add forgotten test-packages `twinw`, `passlib`! + Update bugfix signing `twine` 1.6.1-->1.6.1.
This commit is contained in:
parent
e044b8e74e
commit
3676771719
|
@ -32,4 +32,5 @@ __pycache__/
|
|||
/develop-eggs/
|
||||
/eggs/
|
||||
/parts/
|
||||
/.cache/
|
||||
/.settings/
|
||||
|
|
|
@ -12,7 +12,9 @@ pip install --extra-index-url {{URL}}simple/ PACKAGE [PACKAGE2...]
|
|||
easy_install -i {{URL}}simple/ PACKAGE
|
||||
</pre></blockquote></p>
|
||||
|
||||
<p>The complete list of all packages can be found <a href="{{PACKAGES}}">here</a> or via the <a href="{{SIMPLE}}">simple</a> index.</p>
|
||||
<p>The complete list of all packages can be found <a href="{{PACKAGES}}">here</a>
|
||||
or via the <a href="{{SIMPLE}}">simple</a> index.</p>
|
||||
|
||||
<p>This instance is running version {{VERSION}} of the <a href="http://pypi.python.org/pypi/pypiserver">pypiserver</a> software.</p>
|
||||
<p>This instance is running version {{VERSION}} of the
|
||||
<a href="http://pypi.python.org/pypi/pypiserver">pypiserver</a> software.</p>
|
||||
</body></html>
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
pip>=7
|
||||
setuptools
|
||||
setuptools-git>=0.3
|
||||
passlib
|
||||
tox
|
||||
wheel
|
||||
pytest>=2.3
|
||||
webtest; python_version != '2.5'
|
||||
mock; python_version <= '3.2'
|
||||
gevent>=1.1b4; python_version >= '3'
|
||||
twine>=1.6.0
|
||||
twine>=1.6.1
|
||||
|
||||
WebOb==0.9.6.1; python_version == '2.5'
|
||||
BeautifulSoup==3.2.1; python_version == '2.5'
|
||||
|
|
54
setup.py
54
setup.py
|
@ -9,12 +9,11 @@ if sys.version_info >= (3, 0):
|
|||
else:
|
||||
exec("def do_exec(co, loc): exec co in loc\n")
|
||||
|
||||
tests_require = ['pytest>=2.3', 'tox', 'twine', 'pip>=7']
|
||||
tests_require = ['pytest>=2.3', 'tox', 'twine', 'pip>=7', 'passlib']
|
||||
if sys.version_info <= (3, 2):
|
||||
tests_require.append('mock')
|
||||
|
||||
|
||||
|
||||
def get_version():
|
||||
d = {}
|
||||
try:
|
||||
|
@ -32,42 +31,43 @@ setup(name="pypiserver",
|
|||
package_data={'pypiserver': ['welcome.html']},
|
||||
setup_requires=[
|
||||
'setuptools',
|
||||
'setuptools-git >= 0.3', # Gather package-data from all files in git.
|
||||
# Gather package-data from all files in git.
|
||||
'setuptools-git >= 0.3',
|
||||
'wheel',
|
||||
],
|
||||
extras_require={
|
||||
'passlib': ['passlib']
|
||||
'passlib': ['passlib']
|
||||
},
|
||||
tests_require=tests_require,
|
||||
url="https://github.com/pypiserver/pypiserver",
|
||||
maintainer="Kostis Anagnostopoulos",
|
||||
maintainer_email="ankostis@gmail.com",
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: System Administrators",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"License :: OSI Approved :: zlib/libpng License",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.6",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.2",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: System :: Software Distribution"],
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: System Administrators",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"License :: OSI Approved :: zlib/libpng License",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.6",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.2",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Topic :: Software Development :: Build Tools",
|
||||
"Topic :: System :: Software Distribution"],
|
||||
zip_safe=True,
|
||||
entry_points={
|
||||
'paste.app_factory': ['main=pypiserver:paste_app_factory'],
|
||||
'console_scripts': ['pypi-server=pypiserver.__main__:main']
|
||||
},
|
||||
'paste.app_factory': ['main=pypiserver:paste_app_factory'],
|
||||
'console_scripts': ['pypi-server=pypiserver.__main__:main']
|
||||
},
|
||||
options={
|
||||
'bdist_wheel': {'universal': True},
|
||||
},
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
/build
|
||||
/*egg*
|
||||
|
|
@ -1 +0,0 @@
|
|||
/a-1.0-py3-none-any.whl
|
Binary file not shown.
|
@ -7,12 +7,14 @@ import functools
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
import pip
|
||||
from py import path # @UnresolvedImport
|
||||
import pytest
|
||||
|
||||
|
||||
_BUFF_SIZE = 4096
|
||||
_port = 8090
|
||||
|
||||
|
@ -32,10 +34,11 @@ def _run_server(packdir, port, with_password, other_cli=''):
|
|||
False: "-P. -a."
|
||||
}
|
||||
pswd_opts = pswd_opt_choices[with_password]
|
||||
cmd = "python -m pypiserver.__main__ -v --overwrite -p %s %s %s %s" % (
|
||||
port, pswd_opts, other_cli, packdir)
|
||||
cmd = ("python -m pypiserver.__main__ -v --overwrite"
|
||||
" -p %s %s %s %s" % (port, pswd_opts, other_cli, packdir))
|
||||
proc = subprocess.Popen(cmd.split(), bufsize=_BUFF_SIZE)
|
||||
time.sleep(1)
|
||||
assert proc.poll() is None
|
||||
|
||||
return Srv(proc, int(port), packdir)
|
||||
|
||||
|
@ -59,16 +62,40 @@ def new_server(packdir, port, with_password=False, other_cli=''):
|
|||
_kill_server(srv)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def chdir(d):
|
||||
old_d = os.getcwd()
|
||||
try:
|
||||
os.chdir(d)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(old_d)
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def package():
|
||||
dist_path = path.local('tests/centodeps/wheelhouse')
|
||||
pkgs = list(dist_path.visit('centodeps*.whl'))
|
||||
assert len(pkgs) == 1
|
||||
def package(request):
|
||||
def fin():
|
||||
tmpdir.remove(True)
|
||||
tmpdir = path.local(tempfile.mkdtemp())
|
||||
request.addfinalizer(fin)
|
||||
print(tmpdir)
|
||||
src_setup_py = path.local().join('tests', 'centodeps-setup.py')
|
||||
assert src_setup_py.check()
|
||||
projdir = tmpdir.join('centodeps')
|
||||
projdir.mkdir()
|
||||
dst_setup_py = projdir.join('setup.py')
|
||||
src_setup_py.copy(dst_setup_py)
|
||||
assert dst_setup_py.check()
|
||||
|
||||
pkg = path.local(pkgs[0])
|
||||
assert pkg.check()
|
||||
with chdir(projdir.strpath):
|
||||
assert os.system('python setup.py bdist_wheel') == 0
|
||||
pkgs = list(projdir.join('dist').visit('centodeps*.whl'))
|
||||
assert len(pkgs) == 1
|
||||
|
||||
return pkg
|
||||
pkg = path.local(pkgs[0])
|
||||
assert pkg.check()
|
||||
|
||||
return pkg
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
|
@ -109,14 +136,6 @@ def pypirc(port):
|
|||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def uploader(pypirc, monkeypatch):
|
||||
from twine.commands import upload
|
||||
monkeypatch.setattr(upload.utils, 'get_repository_from_config',
|
||||
lambda *x: pypirc)
|
||||
return upload
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def empty_packdir(tmpdir):
|
||||
return tmpdir.mkdir("dists")
|
||||
|
@ -137,7 +156,7 @@ def _run_pip(cmd):
|
|||
|
||||
def _run_pip_install(cmd, port, install_dir, user=None, pswd=None):
|
||||
url = _build_url(port, user, pswd)
|
||||
ncmd = 'install --download %s -i %s %s' % (install_dir, url, cmd)
|
||||
ncmd = '-vv install --download %s -i %s %s' % (install_dir, url, cmd)
|
||||
return _run_pip(ncmd)
|
||||
|
||||
|
||||
|
@ -172,6 +191,22 @@ def test_pipInstall_protectedOk(protected_server, package, pipdir):
|
|||
assert pipdir.join(package.basename).check()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def uploader(pypirc, monkeypatch):
|
||||
from twine.commands import upload
|
||||
monkeypatch.setattr(upload.utils, 'get_repository_from_config',
|
||||
lambda *x: pypirc)
|
||||
return upload
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def registerer(pypirc, monkeypatch):
|
||||
from twine.commands import register
|
||||
monkeypatch.setattr(register.utils, 'get_repository_from_config',
|
||||
lambda *x: pypirc)
|
||||
return register
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[:2] == (3, 2),
|
||||
reason="urllib3 fails on twine (see https://travis-ci.org/ankostis/pypiserver/builds/81044993)")
|
||||
def test_upload(empty_packdir, port, package, uploader):
|
||||
|
@ -186,21 +221,12 @@ def test_upload(empty_packdir, port, package, uploader):
|
|||
assert empty_packdir.join(
|
||||
package.basename).check(), (package.basename, empty_packdir.listdir())
|
||||
|
||||
|
||||
# def test_register_upload(protected_server, pypirc, package, pipdir):
|
||||
# register(package, repository, username, password,
|
||||
# comment=None, config_file=None)
|
||||
#
|
||||
|
||||
|
||||
# @contextlib.contextmanager
|
||||
# def chdir(d):
|
||||
# old_d = os.getcwd()
|
||||
# try:
|
||||
# os.chdir('tests/centodeps')
|
||||
# yield
|
||||
# finally:
|
||||
# os.chdir(old_d)
|
||||
|
||||
|
||||
# def test_register_upload(open_server, pypirc, package, pipdir):
|
||||
# with chdir('tests/centodeps'):
|
||||
# url = _build_url(open_server.port, user='a', pswd='a')
|
||||
# cmd = "python setup.py register sdist upload -r %s" % url
|
||||
# cmd = "python setup.py --no-user-cfg register sdist upload -r %s" % url
|
||||
# assert subprocess.Popen(cmd.split(), bufsize=_BUFF_SIZE) == 0
|
||||
|
|
Loading…
Reference in New Issue