diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2019-01-03 22:09:02 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2019-01-03 22:09:02 +0000 |
commit | d6689ed2047ccc040d8c3445f8b2703306b2122c (patch) | |
tree | 726386a0723e3dca50dc7814c864e766f9dded33 | |
parent | 01c3761c3e51b61c77a78c354402764de1ad10e2 (diff) | |
parent | 7c681c42d9e53b06dcecd6d6c1f987f8b76ab9e9 (diff) | |
download | buildstream-d6689ed2047ccc040d8c3445f8b2703306b2122c.tar.gz |
Merge branch 'tristan/toxic-linting' into 'master'
Run the linter separately from the tests
See merge request BuildStream/buildstream!1033
-rw-r--r-- | .gitlab-ci.yml | 12 | ||||
-rw-r--r-- | CONTRIBUTING.rst | 21 | ||||
-rw-r--r-- | setup.cfg | 10 | ||||
-rw-r--r-- | tools/dev-requirements.in | 3 | ||||
-rw-r--r-- | tools/dev-requirements.txt | 5 | ||||
-rw-r--r-- | tools/requirements.in | 2 | ||||
-rw-r--r-- | tools/requirements.txt | 2 | ||||
-rw-r--r-- | tox.ini | 9 |
8 files changed, 43 insertions, 21 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7cec8d1ed..67248bc26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -151,6 +151,18 @@ tests-fedora-missing-deps: - ${TEST_COMMAND} +# Lint separately from testing +lint: + stage: test + + before_script: + # Diagnostics + - python3 --version + + script: + - tox -e lint + except: + - schedules # Automatically build documentation for every commit, we want to know # if building documentation fails even if we're not deploying it. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 0079cb4b5..ddcc4130d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1498,6 +1498,18 @@ option when running tox:: tox -e py37 +Linting is performed separately from testing. In order to run the linting step which +consists of running the ``pycodestyle`` and ``pylint`` tools, run the following:: + + tox -e lint + +.. tip:: + + The project specific pylint and pycodestyle configurations are stored in the + toplevel buildstream directory in the ``.pylintrc`` file and ``setup.cfg`` files + respectively. These configurations can be interesting to use with IDEs and + other developer tooling. + The output of all failing tests will always be printed in the summary, but if you want to observe the stdout and stderr generated by a passing test, you can pass the ``-s`` option to pytest as such:: @@ -1532,15 +1544,6 @@ output. To run them, you can use:: tox -- --integration -By default, buildstream also runs pylint on all files. Should you want -to run just pylint (these checks are a lot faster), you can do so -with:: - - tox -- -m pylint - -Alternatively, any IDE plugin that uses pytest should automatically -detect the ``.pylintrc`` in the project's root directory. - In case BuildStream's dependencies were updated since you last ran the tests, you might see some errors like ``pytest: error: unrecognized arguments: --codestyle``. If this happens, you @@ -11,11 +11,13 @@ parentdir_prefix = BuildStream- test=pytest [tool:pytest] -addopts = --verbose --basetemp ./tmp --codestyle --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20 +addopts = --verbose --basetemp ./tmp --cov=buildstream --cov-config .coveragerc --durations=20 norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs python_files = tests/*/*.py -codestyle_max_line_length = 119 -codestyle_ignore = E129 E125 W504 W605 -codestyle_exclude = doc/source/conf.py buildstream/_fuse/fuse.py buildstream/_protos/**/*py env = D:BST_TEST_SUITE=True + +[pycodestyle] +max-line-length = 119 +ignore = E129,E125,W504,W605 +exclude = .git/**,.tox/**,doc/source/conf.py,buildstream/_fuse/fuse.py,buildstream/_protos/**/*py diff --git a/tools/dev-requirements.in b/tools/dev-requirements.in index 42c300f39..9edb23423 100644 --- a/tools/dev-requirements.in +++ b/tools/dev-requirements.in @@ -1,11 +1,10 @@ coverage == 4.4.0 pylint +pycodestyle pytest >= 3.9 -pytest-codestyle >= 1.4.0 pytest-cov >= 2.5.0 pytest-datafiles >= 2.0 pytest-env -pytest-pylint pytest-xdist pytest-timeout pyftpdlib diff --git a/tools/dev-requirements.txt b/tools/dev-requirements.txt index 28e3560e4..d706bc9f5 100644 --- a/tools/dev-requirements.txt +++ b/tools/dev-requirements.txt @@ -1,11 +1,10 @@ coverage==4.4 pylint==2.2.2 +pycodestyle==2.4.0 pytest==4.0.2 -pytest-codestyle==1.4.0 pytest-cov==2.6.0 pytest-datafiles==2.0 pytest-env==0.6.2 -pytest-pylint==0.13.0 pytest-xdist==1.25.0 pytest-timeout==1.3.3 pyftpdlib==1.5.4 @@ -21,8 +20,6 @@ mccabe==0.6.1 more-itertools==5.0.0 pluggy==0.8.0 py==1.7.0 -pycodestyle==2.4.0 pytest-forked==0.2 six==1.12.0 -typed-ast==1.1.1 wrapt==1.10.11 diff --git a/tools/requirements.in b/tools/requirements.in index 7313d7dcf..a3c62c79b 100644 --- a/tools/requirements.in +++ b/tools/requirements.in @@ -1,6 +1,6 @@ Click grpcio >= 1.10 -jinja2 >= 2.10 +Jinja2 >= 2.10 pluginbase protobuf >= 3.5 psutil diff --git a/tools/requirements.txt b/tools/requirements.txt index 17df16af4..7bf3205f7 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -1,5 +1,6 @@ Click==7.0 grpcio==1.17.1 +Jinja2==2.10 pluginbase==0.7 protobuf==3.6.1 psutil==5.4.8 @@ -13,6 +14,5 @@ psutil==5.4.8 ruamel.yaml==0.15.51 setuptools==39.0.1 ## The following requirements were added by pip freeze: -Jinja2==2.10 MarkupSafe==1.1.0 six==1.12.0 @@ -13,6 +13,15 @@ passenv = GI_TYPELIB_PATH INTEGRATION_CACHE +[testenv:lint] +commands = + pycodestyle + pylint buildstream +deps = + -rtools/requirements.txt + -rtools/dev-requirements.txt + -rtools/plugin-requirements.txt + [testenv:docs] commands = make -C doc |