Skip to content

Commit

Permalink
Add flake8 to the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed May 23, 2018
1 parent ff3f625 commit fc0a080
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ install:
- pip3 install -r requirements.txt
- pip3 install coveralls

before_script:
- flake8 .

script:
- coverage run --rcfile=.coveragerc --source='.' -m py.test -vv --runslow
- coverage report -m
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ If you submit a bug report, we appreciate if you include the standard output of
Code style
~~~~~~~~~~

We use the python source code checker `flake8 <http://flake8.pycqa.org/en/latest/>`_ to help us maintain a consistent style across the code base. It runs automatically as part of our `Travis-CI <https://travis-ci.org/JakobGM/astrality>`_ configuration.
We use the python source code checker `flake8
<http://flake8.pycqa.org/en/latest/>`_ to help us maintain a
consistent style across the code base. It runs automatically as
part of our ``pytest`` test-suite.

You can lint your code locally by running ``flake8 .`` from the root of the repository.
Integrating ``flake8`` into your workflow is recommended, there are plugins available for most popular `IDEs <https://foxmask.trigger-happy.eu/post/2016/02/17/pycharm-running-flake8/>`_ and `text-editors <https://github.com/nvie/vim-flake8>`_!
Expand Down
4 changes: 4 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Application wide test configuration."""
import logging

import pytest

logging.getLogger('flake8').setLevel(logging.WARN)


def pytest_addoption(parser):
"""Add command line flags to pytest."""
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ env =
UPPER_CASE_KEY=UPPER_CASE_VALUE
conflicting_key=value1
CONFLICTING_KEY=value2
addopts = --mypy
addopts = --mypy --flake8
log_level = NOTSET
3 changes: 3 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pytest-env
# For running mypy static type analysis as part of pytest with --mypy flag
pytest-mypy

# For integrating flake8 into the test suite
pytest-flake8

# For typing
mypy

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pyflakes==1.6.0 # via flake8
pygments==2.2.0 # via sphinx
pyparsing==2.2.0 # via packaging
pytest-env==0.6.2
pytest-flake8==1.0.1
pytest-freezegun==0.2.0
pytest-mypy==0.3.1
pytest==3.6.0
Expand Down

0 comments on commit fc0a080

Please sign in to comment.