Skip to content

Commit

Permalink
Revert readme and fix pep8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
LyzardKing committed Feb 26, 2020
1 parent 413ec60 commit bfb1b86
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ $ ./runtests pep8

This will run those pep8 checks on the code.

You can also run the pycodestyle or pep8 tool directly from the project directory:

```sh
$ pycodestyle/pep8 .
```

### Tests
#### Types of tests
There are four types of tests that can be combined in runtests:
Expand All @@ -115,21 +121,21 @@ There are four types of tests that can be combined in runtests:
* **medium**: Tests the whole workflow. It directly calls end user tools from the command line, but without affecting the local system. Requirements like installing packages are mocked, as well as the usage of a local webserver serving (smaller) content similar to what will be fetched in a real use case. The assets have the same formats and layout.
* **large**: Runs the same tests as the medium test, but with real server downloads and installation of dpkg packages. Most of these tests need root privileges. Be aware that these tests only run on a graphical environment. It will interfere with it and it is likely to install or remove packages on your system.

To run the pep8/pycodestyle tests:
To run all the tests, with coverage report:

```sh
$ ./runtests
```

#### Running some tests with all debug infos
By default, **runtests** will show the status of the single tests, like pytest does. However, one can select the specific tests to run via:
#### Running some tests with all debug infossome
By default, **runtests** will not display any debug output if the tests are successful, similar to pytest. However, if only tests are selected, runtests will a display full debug log,

```sh
$ ./runtests tests/small/test_tools.py::TestConfigHandler
```

#### More information on runtests
**runtests** is a small pytest wrapper used to simplify the testing process. By default, if no arguments are supplied or if "pep8" is supplied, runtests will run the pycodestyle/pep8 and flake8 tests.
**runtests** is a small pytest wrapper used to simplify the testing process. By default, if no arguments are supplied, runtests will run all available tests on the project using the production nose configuration.
It is possible to run only some types of tests:

```sh
Expand Down
2 changes: 1 addition & 1 deletion pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ git stash -q --keep-index
if [ -d env/ ]; then
. env/bin/activate
fi
./pyruntests pep8
./runtests pep8
RESULT=$?
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
Expand Down
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,14 @@ max-line-length = 120
# W504 (*) line break after binary operator
ignore = E111, E722, W504

[pep8]
exclude = env/
max-line-length = 120
# Ignore:
# E111 indentation is not a multiple of four
# E722 do not use bare except, specify exception instead
# W504 (*) line break after binary operator
ignore = E111, E722, W504

[tool:pytest]
addopts = -v --maxfail 1
8 changes: 7 additions & 1 deletion tests/test_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
"""Ensure we keep a sane formatting syntax"""

import os
import pycodestyle
try:
import pycodestyle
except:
import pep8 as pycodestyle
import umake
import subprocess
import sys

from .tools import get_root_dir
from unittest import TestCase
from pytest import mark

# we want to use either local or system umake, but always local tests files
umake_dir = os.path.dirname(umake.__file__)
Expand All @@ -44,6 +49,7 @@ def test_pep8(self):
os.path.join(get_root_dir(), "bin")])
self.assertEqual(results.get_statistics(), [])

@mark.skipif("pycodestyle" not in sys.modules.keys(), reason="requires pycodestyle")
def test_pyflakes_imports(self):
"""Check for unused imports with flake8
Expand Down

0 comments on commit bfb1b86

Please sign in to comment.