From c4fde819831bba1c4c36a1e4b9f607aec07f4d8e Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Sep 21 2018 02:58:04 +0000 Subject: [PATCH 1/2] Specify dependent packages in one place setup.py is the place to inject dependent packages, both install or tests. All the packages are read from pip requirements files pypi.txt and test-pypi.txt, then modified and packages specific for Python 2.6 are added in setup.py. tox.ini is updated accordingly as well. Major changes are: * some deeper dependent packages, which have dropped Python 2.6 support, are listed for py26 specificially. * instead of enabling tox config usedevelop, install dependent packages listed in setup.py by pip `-e` option. * run tests by `setup.py nosetests` which can install packages listed in `tests_require`. As a result, dependent packages for all supported Python versions should be added to pypi.txt, which will be in `install_requires` eventually. Any packages specific to Python 2.6 or not should be listed in setup.py explicitly. Signed-off-by: Chenxiong Qi --- diff --git a/requirements/test-pypi.txt b/requirements/test-pypi.txt index 3df4b44..b85c9a5 100644 --- a/requirements/test-pypi.txt +++ b/requirements/test-pypi.txt @@ -1,8 +1,5 @@ --r pypi.txt - coverage mock == 1.0.1 -nose == 1.3.7 # used in MBS tests openidc-client diff --git a/setup.py b/setup.py index 0bbbf8b..2233bf1 100755 --- a/setup.py +++ b/setup.py @@ -45,6 +45,10 @@ if ver[0] <= 2 and ver[1] < 7: tests_require += [ 'unittest2' ] +else: + install_requires += [ + 'PyGObject', + ] readme_rst = os.path.join(setup_py_path, 'README.rst') with open(readme_rst, 'r') as readme: diff --git a/tox.ini b/tox.ini index da909bf..56bbdb5 100644 --- a/tox.ini +++ b/tox.ini @@ -3,25 +3,33 @@ envlist = py26,py27,py36,py37,flake8,doc [testenv] skip_install = True -base_deps = +deps = rpm-py-installer -r{toxinidir}/requirements/test-pypi.txt -deps = - {[testenv]base_deps} - PyGObject + + ; Tests run by `setup.py nosetests`, which require nose is + ; installed in advance. + nose==1.3.7 + + ; Python 2.6 support has been dropped since specific version of these + ; packages. These packages are dependencies through the dependent path. + + py26: pycparser<2.19 + py26: python-dateutil<2.7.0 + ; Required by koji + py26: pyOpenSSL<18.0.0 commands = - nosetests {posargs} + ; Respect the install_requires in setup.py and install dependent packages + ; from there. An alternative is to use tox option usedevelop, however it + ; does not work for rpkg now due to the PyGObject, which can only be + ; installed via pip. Refer to upstream issue + ; https://gitlab.gnome.org/GNOME/pygobject/issues/264 + pip install -e . + + python setup.py nosetests {posargs} setenv= PYCURL_SSL_LIBRARY=openssl -[testenv:py26] -deps = - # Requirement path: koji -> pyOpenSSL - # Since this version, Python 2.6 support has been dropped. - pyOpenSSL<18.0.0 - unittest2 - {[testenv]base_deps} - [testenv:flake8] basepython = python3 skip_install = True From 727c1350fe5425ec80b5d684197578923b372ac9 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Sep 21 2018 03:04:22 +0000 Subject: [PATCH 2/2] Allow to pass posargs to tox from make Signed-off-by: Chenxiong Qi --- diff --git a/Makefile b/Makefile index f0fc722..1eaeab2 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,15 @@ test: $(default_targets) py26-test: @virtualenv --python=python2.6 .py26env @.py26env/bin/pip install tox - @.py26env/bin/tox -e py26 + @.py26env/bin/tox -e py26 -- $(TOX_POSARGS) .PHONY: py26-test detox: - @detox -e py27,py36,py37,flake8 + @detox -e py27,py36,py37,flake8 -- $(TOX_POSARGS) .PHONY: detox tox: @python3 -m venv .env @.env/bin/pip install tox - @.env/bin/tox -e py27,py36,py37,flake8 + @.env/bin/tox -e py27,py36,py37,flake8 -- $(TOX_POSARGS) .PHONY: tox