From a9b593c3f51cff7446d448b21410cb9a3767450b Mon Sep 17 00:00:00 2001 From: Simon Perkins Date: Mon, 22 Jul 2019 15:21:17 +0200 Subject: [PATCH] Use pytest-flake8 (#56) --- .github/PULL_REQUEST_TEMPLATE.md | 33 ++++++++++++++++---------------- .travis.yml | 1 - HISTORY.rst | 1 + docker/python36.docker | 9 +++------ setup.cfg | 6 +++--- setup.py | 2 +- tox.ini | 28 --------------------------- 7 files changed, 25 insertions(+), 55 deletions(-) delete mode 100644 tox.ini diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f6ff33e..dc8702a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,20 +3,20 @@ and one of the `docs/*-api.rst` files for new API -
-Howto run test cases and lint the code base - ```bash - $ py.test -v -s tricolour - ``` -If the pep8 tests fail, the quickest way to correct -this is to run `autopep8` and then `flake8` and -`pycodestyle` to fix the remaining issues. +
+ Howto run test cases and lint the code base + +```bash +$ py.test --flake8 -v -s tricolour +``` + +If you encounter flake8 failures, a quick way to correct +this is to run `autopep8` and `flake8` again. ```bash -$ pip install -U autopep8 flake8 pycodestyle +$ pip install -U autopep8 $ autopep8 -r -i tricolour $ flake8 tricolour -$ pycodestyle tricolour ```
@@ -25,11 +25,12 @@ $ pycodestyle tricolour
Howto build the documentation - To build the docs locally: +To build the docs locally: + +```bash +$ pip install -r requirements.readthedocs.txt +$ cd docs +$ READTHEDOCS=True make html +``` - ``` - pip install -r requirements.readthedocs.txt - cd docs - READTHEDOCS=True make html - ```
diff --git a/.travis.yml b/.travis.yml index a2aa167..bf71ed9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: python python: - 3.6 - - 3.5 # Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: pip install -U tox-travis diff --git a/HISTORY.rst b/HISTORY.rst index e5347f0..557c196 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,6 +5,7 @@ History 0.1.3 (YYYY-MM-DD) ------------------ +* Use pytest-flake8 when running test cases (:pr:`56`) * Fix polarisation flagging for uncalibrated data (:pr:`55`) * Add ability to flag on total power (:pr:`55`) * Baseline statistics (:pr:`55`) diff --git a/docker/python36.docker b/docker/python36.docker index e285aad..6bff64a 100644 --- a/docker/python36.docker +++ b/docker/python36.docker @@ -2,15 +2,12 @@ FROM kernsuite/base:5 # Install base requirements RUN docker-apt-install python3-pip -RUN pip3 install --upgrade pip setuptools flake8 +RUN pip3 install --upgrade pip setuptools ADD . /code WORKDIR /code # Install base + testing packages RUN pip3 install .[testing] -# Run tests -RUN py.test -s -vvv . - -# Flake the repository -RUN flake8 . +# Run tests and flake at the same time +RUN py.test --flake8 -s -vvv . diff --git a/setup.cfg b/setup.cfg index 769ea38..f5f9a3b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,8 @@ [bumpversion] -current_version = 0.1.0 +current_version = 0.1.2 commit = True tag = True -tag_name = {current_version} +tag_name = {new_version} [bumpversion:file:setup.py] @@ -25,4 +25,4 @@ test = pytest [tool:pytest] collect_ignore = ['setup.py'] - +norecursedirs = docs diff --git a/setup.py b/setup.py index f188773..7dee074 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ 'zarr >= 2.3.1' ] -extras_require = {'testing': ['pytest', 'requests']} +extras_require = {'testing': ['pytest', 'pytest-flake8', 'requests']} setup( author="Simon Perkins", diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 19d4c73..0000000 --- a/tox.ini +++ /dev/null @@ -1,28 +0,0 @@ -[tox] -envlist = py27, py34, py35, py36, flake8 - -[travis] -python = - 3.6: py36 - 3.5: py35 - 3.4: py34 - 2.7: py27 - -[testenv:flake8] -basepython = python -deps = flake8 -commands = flake8 tricolour - -[testenv] -setenv = - PYTHONPATH = {toxinidir} -deps = - -r{toxinidir}/requirements_dev.txt -; If you want to make tox run the tests with the same versions, create a -; requirements.txt with the pinned versions and uncomment the following line: -; -r{toxinidir}/requirements.txt -commands = - pip install -U pip - py.test --basetemp={envtmpdir} - -