diff --git a/.gitignore b/.gitignore index 9245c34..6011ba8 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,6 @@ Vagrantfile #Ignore generated dockerfile dev/docker/test_env + +# Tox virtualenvs +.tox diff --git a/run_ci_tests.sh b/run_ci_tests.sh index 9654df2..23f3097 100755 --- a/run_ci_tests.sh +++ b/run_ci_tests.sh @@ -1,9 +1,9 @@ -yum install -y python-virtualenv \ - gcc python-cryptography \ +yum install -y python-virtualenv python34 \ + gcc python-cryptography python34-cryptography \ libgit2 python-pygit2 \ redis swig openssl-devel m2crypto \ - python2-fedmsg fedmsg \ - python2-pylint python-pep8 + python2-fedmsg python34-fedmsg-core fedmsg \ + python-tox sysctl -w fs.file-max=2048 @@ -29,36 +29,27 @@ git log -2 fi -virtualenv pagureenv --system-site-packages -source pagureenv/bin/activate - -pip install pip --upgrade -# Needed within the venv -pip install nose --upgrade -pip install --upgrade --force-reinstall python-fedora 'setuptools>=17.1' pygments -pip install -r tests_requirements.txt -pip install -r requirements-ev.txt # We have one test on the SSE server -sed -i -e 's|pygit2 >= 0.20.1||' requirements.txt -pip install -r requirements.txt -pip install psycopg2 -pip install python-openid python-openid-teams python-openid-cla +#virtualenv pagureenv --system-site-packages +#source pagureenv/bin/activate +# +#pip install pip --upgrade +## Needed within the venv +#pip install nose --upgrade +#pip install --upgrade --force-reinstall python-fedora 'setuptools>=17.1' pygments +#pip install -r tests_requirements.txt +#pip install -r requirements-ev.txt # We have one test on the SSE server +#sed -i -e 's|pygit2 >= 0.20.1||' requirements.txt +#pip install -r requirements.txt +#pip install psycopg2 +#pip install python-openid python-openid-teams python-openid-cla # pip uninstall cffi -y -trap deactivate SIGINT SIGTERM EXIT - - -# Reload where the nosetests app is (within the venv) -hash -r +#trap deactivate SIGINT SIGTERM EXIT -python setup.py build - -PAGURE_CONFIG=`pwd`/tests/test_config \ -PYTHONPATH=pagure \ -./nosetests -v --with-xcoverage --cover-erase --cover-package=pagure +tox --sitepackages -e 'py{27,34}-flask011-ci' -- -v --with-xcoverage --cover-erase --cover-package=pagure set +e -PYTHONPATH=pagure pylint-2 -f parseable pagure | tee pylint.out -pep8 pagure/*.py pagure/*/*.py | tee pep8.out - +tox --sitepackages -e pylint -- -f parseable | tee pylint.out +tox --sitepackages -e lint | tee flake8.out diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..238b571 --- /dev/null +++ b/tox.ini @@ -0,0 +1,49 @@ +[tox] +envlist = py{27,34,35,36}-flask01{1,2},lint +skipsdist = True + + +[testenv] +usedevelop = True +deps = + flask011: flask>=0.11,<0.12 + flask012: flask>=0.12,<0.13 + -rtests_requirements.txt + ci: -rrequirements-ev.txt + ci: psycopg + ci: python-openid python-openid-teams python-openid-cla +setenv = + PAGURE_CONFIG={toxinidir}/tests/test_config + PYTHONPATH={toxinidir} +commands = + #nosetests --with-coverage --cover-erase --cover-package=pagure --with-pagureperf {posargs} + nosetests {posargs} + + +[testenv:timetests] +basepython = python3 +deps = + -rtests_requirements.txt + nose-timer +commands = + nosetests --with-timer --timer-top-n 10 --timer-ok 500ms --timer-warning 1 --timer-json-file tests-duration.json {posargs} + + +[testenv:lint] +basepython = python3 +deps = + flake8 > 3.0 +setenv = + PYTHONPATH={toxinidir} +commands = + python -m flake8 {posargs:pagure} + + +[testenv:pylint] +basepython = python3 +deps = + pylint +setenv = + PYTHONPATH={toxinidir} +commands = + pylint pagure {posargs}