diff --git a/CONTRIBUTING.asciidoc b/CONTRIBUTING.asciidoc index c8c70c3c2..f015880a4 100644 --- a/CONTRIBUTING.asciidoc +++ b/CONTRIBUTING.asciidoc @@ -89,21 +89,39 @@ Checkers qutebrowser uses http://tox.readthedocs.org/en/latest/[tox] to run its unittests and several linters/checkers. -Currently, the following tools will be invoked when you run `tox`: +Currently, following tox environments are available: -* Unit tests using https://www.pytest.org[pytest]. -* https://pypi.python.org/pypi/pyflakes[pyflakes] via https://pypi.python.org/pypi/pytest-flakes[pytest-flakes] -* https://pypi.python.org/pypi/pep8[pep8] via https://pypi.python.org/pypi/pytest-pep8[pytest-pep8] -* https://pypi.python.org/pypi/mccabe[mccabe] via https://pypi.python.org/pypi/pytest-mccabe[pytest-mccabe] -* https://github.com/GreenSteam/pep257/[pep257] -* http://pylint.org/[pylint] -* https://pypi.python.org/pypi/pyroma/[pyroma] -* https://github.com/mgedmin/check-manifest[check-manifest] -* `scripts/misc_checks.py` which checks for the following things: +* Tests using https://www.pytest.org[pytest]: + - `py34`: Run pytest for python-3.4. + - `py35`: Run pytest for python-3.5. + - `py34-cov`: Run pytest for python-3.4 with code coverage report. + - `py35-cov`: Run pytest for python-3.4 with code coverage report. +* `flake8`: Run https://pypi.python.org/pypi/flake8[flake8] checks: + https://pypi.python.org/pypi/pyflakes[pyflakes], + https://pypi.python.org/pypi/pep8[pep8], + https://pypi.python.org/pypi/mccabe[mccabe] +* `vulture`: Run https://pypi.python.org/pypi/vulture[vulture] to find + unused code portions. +* `pylint`: Run http://pylint.org/[pylint] static code analysis. +* `pydocstyle`: Check + https://www.python.org/dev/peps/pep-0257/[PEP257] compliance with + https://github.com/PyCQA/pydocstyle[pydocstyle] +* `pyroma`: Check packaging practices with + https://pypi.python.org/pypi/pyroma/[pyroma] +* `eslint`: Run http://eslint.org/[ESLint] javascript checker. +* `check-manifest`: Check MANIFEST.in completeness with + https://github.com/mgedmin/check-manifest[check-manifest] +* `mkvenv`: Bootstrap a virtualenv for testing. +* `misc`: Run `scripts/misc_checks.py` to check for: - untracked git files - VCS conflict markers + - common spelling mistakes + +The default test suite is run with `tox`, the list of default +environments is obtained with `tox -l` . Please make sure the checks run without any warnings on your new contributions. + There's of course the possibility of false-positives, and the following techniques are useful to handle these: @@ -122,6 +140,31 @@ smallest scope which makes sense. Most of the time, this will be line scope. * If you really think a check shouldn't be done globally as it yields a lot of false-positives, let me know! I'm still tweaking the parameters. + +Running Specific Tests +~~~~~~~~~~~~~~~~~~~~~~ + +While you are developing you often don't want to run the full test +suite each time. + +Specific test environments can be run with `tox -e `. + +Additional parameters can be passed to the test scripts by separating +them from `tox` arguments with `--`. + +Examples: + +---- +# run only pytest tests which failed in last run: +tox -e py35 -- --lf + +# run only the integration feature tests: +tox -e py35 -- tests/integration/features + +# run everything with undo in the generated name, based on the scenario text +tox -e py35 -- tests/integration/features/test_tabs.py -k undo +---- + Profiling ~~~~~~~~~ @@ -246,22 +289,22 @@ When using Qt objects, two issues must be taken care of: * Methods of Qt objects report their status by using their return values, instead of using exceptions. + -If a function gets or returns a Qt object which -has an `.isValid()` method such as `QUrl` or `QModelIndex`, there's a helper -function `ensure_valid` in `qutebrowser.utils.qt` which should get called on -all such objects. It will raise `qutebrowser.utils.qt.QtValueError` if the -value is not valid. +If a function gets or returns a Qt object which has an `.isValid()` +method such as `QUrl` or `QModelIndex`, there's a helper function +`ensure_valid` in `qutebrowser.utils.qtutils` which should get called +on all such objects. It will raise +`qutebrowser.utils.qtutils.QtValueError` if the value is not valid. + If a function returns something else on error, the return value should carefully be checked. -* Methods of Qt objects have certain maximum values, based on their underlying -C++ types. +* Methods of Qt objects have certain maximum values, based on their +underlying C++ types. + -When passing a numeric parameter to a Qt function, all numbers should be -range-checked using `qutebrowser.utils.check_overflow`, or passing a value -which is too large should be avoided by other means (e.g. by setting a maximum -value for a config object). +When passing a numeric parameter to a Qt function, all numbers should +be range-checked using `qutebrowser.qtutils.check_overflow`, or +passing a value which is too large should be avoided by other means +(e.g. by setting a maximum value for a config object). [[object-registry]] The object registry @@ -363,9 +406,9 @@ then gets passed as the `self` parameter to the handler. The `scope` argument selects which object registry (global, per-tab, etc.) to use. See the <> section for details. -There are also other arguments to customize the way the command is registered, -see the class documentation for `register` in `qutebrowser.commands.utils` for -details. +There are also other arguments to customize the way the command is +registered, see the class documentation for `register` in +`qutebrowser.commands.cmdutils` for details. The types of the function arguments are inferred based on their default values, e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in diff --git a/README.asciidoc b/README.asciidoc index 927b39da4..3d7c4a276 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -151,8 +151,8 @@ Contributors, sorted by the number of commits in descending order: * Joel Torstensson * Felix Van der Jeugt * Claude -* meles5 * Patric Schmitz +* meles5 * Artur Shaik * Nathan Isom * Austin Anderson diff --git a/doc/help/index.asciidoc b/doc/help/index.asciidoc index 56bb3a807..4396b765f 100644 --- a/doc/help/index.asciidoc +++ b/doc/help/index.asciidoc @@ -12,6 +12,7 @@ The following help pages are currently available: * link:commands.html[Documentation of commands] * link:settings.html[Documentation of settings] * link:userscripts.html[How to write userscripts] +* link:CONTRIBUTING.html[Contributing to qutebrowser] Getting help ------------ diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index 7ef118c4f..dfcb342a3 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -43,6 +43,7 @@ class AsciiDoc: FILES = [ ('FAQ.asciidoc', 'qutebrowser/html/doc/FAQ.html'), ('CHANGELOG.asciidoc', 'qutebrowser/html/doc/CHANGELOG.html'), + ('CONTRIBUTING.asciidoc', 'qutebrowser/html/doc/CONTRIBUTING.html'), ('doc/quickstart.asciidoc', 'qutebrowser/html/doc/quickstart.html'), ('doc/userscripts.asciidoc', 'qutebrowser/html/doc/userscripts.html'), ]