diff options
| author | Bert JW Regeer <bertjw@regeer.org> | 2020-05-04 01:03:03 -0700 |
|---|---|---|
| committer | Bert JW Regeer <bertjw@regeer.org> | 2020-05-06 19:54:29 -0700 |
| commit | b6df90d05262dc24a91f7edd1e477cf7e8a9fff6 (patch) | |
| tree | 555aad05b4e9220f193fabe08ed3576bb5b87e66 /HACKING.txt | |
| parent | 72eca2f8e82f1af20e433218719d99e7627d5650 (diff) | |
| download | pyramid-b6df90d05262dc24a91f7edd1e477cf7e8a9fff6.tar.gz pyramid-b6df90d05262dc24a91f7edd1e477cf7e8a9fff6.tar.bz2 pyramid-b6df90d05262dc24a91f7edd1e477cf7e8a9fff6.zip | |
Cleanup nosetest mentions in docs
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Diffstat (limited to 'HACKING.txt')
| -rw-r--r-- | HACKING.txt | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/HACKING.txt b/HACKING.txt index 87c96aef1..7e4969990 100644 --- a/HACKING.txt +++ b/HACKING.txt @@ -8,7 +8,7 @@ Using a Development Checkout ---------------------------- You will have to create a development environment to hack on Pyramid, using a -Pyramid checkout. We use `tox` to run tests, run test coverage, and build +Pyramid checkout. We use `tox` to run tests, run test coverage, and build documentation. tox docs: https://tox.readthedocs.io/en/latest/ @@ -25,6 +25,22 @@ tox on PyPI: https://pypi.org/project/tox/ Alternatively, create a writeable fork on GitHub and clone it. +- Make sure that `tox` is installed, either in your path, or locally. Examples + below assume that `tox` was installed with: + + $ pip3 install --user tox + $ export TOX=$(python3 -c 'import site; print(site.USER_BASE + "/bin")')/tox + + Feel free to use whatever is your favorite method for installation. One + popular method uses `pipx` (https://github.com/pipxproject/pipx). + + Before you file a pull request, we recommend that you run your proposed + change through `tox`. `tox` will fully validate that all tests work, all + supported formats of documentation will build and their doctests pass, and + test coverage is 100%, across all supported versions of Python. `tox` will + only run builds for Python versions that you have installed and made + available to `tox`. Setting up that environment is outside the scope of this + document. Adding Features --------------- @@ -51,58 +67,43 @@ Coding Style - Pyramid uses Black (https://pypi.org/project/black/) and isort (https://pypi.org/project/isort/) for code formatting style. To run formatters: - $ tox -e format + $ $TOX -e format Running Tests ------------- -- The `tox.ini` uses `nose` and `coverage`. As such `tox` may be used +- The `tox.ini` uses `pytest` and `coverage`. As such `tox` may be used to run groups of tests or only a specific version of Python. For example, the - following command will run tests on Python 3.7 only without coverage: + following command will run tests on the same version of Python that `tox` is + installed with: - $ tox -e py37 + $ $TOX -e py - This command will run tests on the latest version of Python 3 with coverage. + To run `tox` for Python 3.8 explicitly, you may use: - $ tox -e py36-cover,coverage + $ $TOX -e py38 -- To run individual tests (i.e., during development), you can use `nosetests` +- To run individual tests (i.e., during development), you can use `pytest` syntax as follows, where `$VENV` is an environment variable set to the path to your virtual environment: # run a single test - $ $VENV/bin/nosetests tests.test_module:ClassName.test_mytestname + $ $TOX -e py -- --no-cov tests/test_httpexceptions.py::TestHTTPMethodNotAllowed::test_it_with_default_body_tmpl # run all tests in a class - $ $VENV/bin/nosetests tests.test_module:ClassName - - Optionally you can install a nose plugin `nose-selecttests` to run specific - tests. - https://pypi.org/project/nose-selecttests/ - For example, use a regular expression with the `-t` parameter to run tests. - - # run a single test - $ $VENV/bin/nosetests -t test_mytestname - -- The tests can also be run using `pytest`. - https://docs.pytest.org/en/latest/ - This is intended as a convenience for people who prefer `pytest`. Run the - tests like so: - - $ $VENV/bin/pip install pytest - $ $VENV/bin/pytest --strict pyramid/ tests/ + $ $TOX -e py -- --no-cov tests/test_httpexceptions.py::TestHTTPMethodNotAllowed - To run individual tests (i.e., during development), see "pytest usage - - Specifying tests / selecting tests": +- For more information on how to use pytest, please refer to the pytest + documentation for selecting tests: https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests Test Coverage ------------- -- The codebase *must* have 100% test statement coverage after each commit. You - can test coverage via `tox -epy3-cover,coverage`. +- The codebase *must* have 100% test statement coverage after each commit. You + can test coverage via `tox -e py38`. Documentation Coverage and Building HTML Documentation @@ -111,11 +112,11 @@ Documentation Coverage and Building HTML Documentation If you fix a bug, and the bug requires an API or behavior modification, all documentation in this package which references that API or behavior must be changed to reflect the bug fix, ideally in the same commit that fixes the bug -or adds the feature. To build and review docs, use the following steps. +or adds the feature. To build and review docs, use the following steps. 1. In the main Pyramid checkout directory, run `tox -e docs`: - $ tox -e docs + $ $TOX -e docs 2. Open the `.tox/docs/html/index.html` file to see the resulting HTML rendering. @@ -125,6 +126,6 @@ Change Log ---------- - Feature additions and bugfixes must be added to the `CHANGES.rst` - file in the prevailing style. Changelog entries should be long and - descriptive, not cryptic. Other developers should be able to know + file in the prevailing style. Changelog entries should be long and + descriptive, not cryptic. Other developers should be able to know what your changelog entry means. |
