| |
@@ -0,0 +1,75 @@
|
| |
+ [tox]
|
| |
+ envlist = flake8,py2,py3
|
| |
+
|
| |
+ [testenv:flake8]
|
| |
+ deps =
|
| |
+ flake8
|
| |
+ # On EL6, pip would get us a flake8 that doesn't work with python2.6. The next
|
| |
+ # two lines let us use an RPM-based version from EPEL if it is installed
|
| |
+ sitepackages = true
|
| |
+ whitelist_externals = flake8
|
| |
+ # These two lines just speed things up by avoiding unnecessary setup
|
| |
+ skip_install=true
|
| |
+ usedevelop=true
|
| |
+ commands =
|
| |
+ flake8
|
| |
+
|
| |
+ [testenv]
|
| |
+ deps =
|
| |
+ -r{toxinidir}/requirements.txt
|
| |
+ -r{toxinidir}/test-requirements.txt
|
| |
+ # We need to access python-rpm, at least, and potentially more on EL6
|
| |
+ sitepackages = true
|
| |
+ # Tell the rpm-py-installer package to download binaries instead of building
|
| |
+ # from source
|
| |
+ setenv =
|
| |
+ RPM_PY_INSTALL_BIN=true
|
| |
+ # If rpm's python bindings are missing, don't continue
|
| |
+ # Also, because coverage might be installed system-wide and it serves as our
|
| |
+ # entry point, let's make sure it's installed in the virtualenv.
|
| |
+ commands_pre =
|
| |
+ {envbindir}/python -c "import rpm"
|
| |
+ pip install -I coverage
|
| |
+
|
| |
+ [testenv:py3]
|
| |
+ setenv =
|
| |
+ {[testenv]setenv}
|
| |
+ PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib
|
| |
+ commands_pre =
|
| |
+ {[testenv]commands_pre}
|
| |
+ {envbindir}/coverage3 erase --rcfile .coveragerc3
|
| |
+ commands =
|
| |
+ {envbindir}/coverage3 run --rcfile .coveragerc3 --source . -m nose
|
| |
+ {envbindir}/coverage3 report --rcfile .coveragerc3
|
| |
+ {envbindir}/coverage3 html -d {toxinidir}/htmlcov/py3 --rcfile .coveragerc3
|
| |
+
|
| |
+ [testenv:py2]
|
| |
+ setenv =
|
| |
+ {[testenv]setenv}
|
| |
+ PYTHONPATH=.:plugins/builder/.:plugins/cli/.:cli/.:www/lib
|
| |
+ PYTHONHASHSEED=0
|
| |
+ commands_pre =
|
| |
+ {[testenv]commands_pre}
|
| |
+ {envbindir}/coverage2 erase
|
| |
+ commands =
|
| |
+ {envbindir}/coverage2 run --source . -m nose \
|
| |
+ tests/test_builder tests/test_cli \
|
| |
+ tests/test_plugins/test_runroot_builder.py \
|
| |
+ tests/test_plugins/test_save_failed_tree_builder.py \
|
| |
+ tests/test_plugins/test_runroot_cli.py \
|
| |
+ tests/test_plugins/test_save_failed_tree_cli.py
|
| |
+ {envbindir}/coverage2 report
|
| |
+ {envbindir}/coverage2 html -d {toxinidir}/htmlcov/py2
|
| |
+
|
| |
+ # This is identical to the py2 testenv, but without attempting to install
|
| |
+ # dependencies from requirements.txt. In practice this will mean RPM-based
|
| |
+ # dependencies must be installed.
|
| |
+ [testenv:py2-rpmdeps]
|
| |
+ deps =
|
| |
+ -r{toxinidir}/test-requirements.txt
|
| |
+ setenv =
|
| |
+ {[testenv:py2]setenv}
|
| |
+ commands_pre =
|
| |
+ {[testenv:py2]commands_pre}
|
| |
+ commands =
|
| |
+ {[testenv:py2]commands}
|
| |
I wanted to try my hand at fixing some koji bugs, but had trouble getting the tests to run so I ended up getting them to use tox, and virtualenvs. This of course won't make the tests faster or greener, but does modernize the infrastructure a bit.
In my testing, this preserved the ability to use entirely RPM versions of the dependencies, or entirely PyPA versions, or a mix. I don't know how it will fare in Jenkins, but I'll fix issues that pop up once the CI runs on this PR.
I've also provided some Dockerfiles that were very helpful for me.