From 906ea629f635bef61d614541c38eac7ad0f076aa Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 22 May 2015 20:23:37 +0200 Subject: [PATCH 1/2] use py.test for testing, document it locally (via tox) and also on travis ci. --- .travis.yml | 2 +- docs/installation.rst | 2 +- setup.cfg | 2 ++ tox.ini | 10 +++++++--- 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 setup.cfg diff --git a/.travis.yml b/.travis.yml index 367458353..87d3afb02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ install: - "pip install --use-mirrors Cython" - "pip install -e ." # command to run tests -script: fakeroot -u python -m borg.testsuite.run -vb +script: fakeroot -u py.test diff --git a/docs/installation.rst b/docs/installation.rst index ec47fe3ae..58073a7a8 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -69,7 +69,7 @@ Some of the steps detailled below might be useful also for non-git installs. # install some dependencies into virtual env pip install cython # to compile .pyx -> .c - pip install tox # optional, for running unit tests + pip install tox pytest # optional, for running unit tests pip install sphinx # optional, to build the docs # get |project_name| from github, install it diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..c9f4a34c7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[pytest] +python_files = testsuite/*.py diff --git a/tox.ini b/tox.ini index 46e4c01d7..619fc01ff 100644 --- a/tox.ini +++ b/tox.ini @@ -3,9 +3,13 @@ envlist = py32, py33, py34 [testenv] # Change dir to avoid import problem -changedir = docs -commands = {envpython} -m borg.testsuite.run -bv [] +changedir = {envdir} +deps = + pytest +commands = py.test passenv = * # fakeroot -u needs some env vars [testenv:py32] -deps = mock +deps = + pytest + mock From e1c7da1f53ec95e76476f704c4127d02b8cde55f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 22 May 2015 20:40:43 +0200 Subject: [PATCH 2/2] add flake8 configuration (style checker) currently adjusted in a way it does not throw errors and warnings with the source as it is now. issues will get fixed over time and the exclude list shall get shorter. --- setup.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.cfg b/setup.cfg index c9f4a34c7..2f726b562 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,8 @@ [pytest] python_files = testsuite/*.py + +[flake8] +ignore = E123,E126,E127,E129,E203,E221,E226,E231,E241,E265,E301,E302,E303,E713,F401,F403,W291,W293,W391 +max-line-length = 250 +exclude = versioneer.py,docs/conf.py,borg/_version.py +max-complexity = 100