mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
update documentation for FastAPI tests and deps.
Additionally, we now ask for two more favors from contributors: 1. All source modified or added within a patchset **must** maintain equivalent or increased coverage by providing tests that use the functionality. 2. Please keep your source within an 80 column width. PS: Sneak a few test Makefile and gitlab fixes. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
57c11ae13f
commit
52ab056e18
4 changed files with 68 additions and 7 deletions
|
@ -8,3 +8,12 @@ You can add a git hook to do this by installing `python-pre-commit` and running
|
||||||
`pre-commit install`.
|
`pre-commit install`.
|
||||||
|
|
||||||
[1] https://lists.archlinux.org/listinfo/aur-dev
|
[1] https://lists.archlinux.org/listinfo/aur-dev
|
||||||
|
|
||||||
|
### Coding Guidelines
|
||||||
|
|
||||||
|
1. All source modified or added within a patchset **must** maintain equivalent
|
||||||
|
or increased coverage by providing tests that use the functionality.
|
||||||
|
|
||||||
|
2. Please keep your source within an 80 column width.
|
||||||
|
|
||||||
|
Test patches that increase coverage in the codebase are always welcome.
|
||||||
|
|
4
INSTALL
4
INSTALL
|
@ -48,8 +48,8 @@ read the instructions below.
|
||||||
4) Install Python modules and dependencies:
|
4) Install Python modules and dependencies:
|
||||||
|
|
||||||
# pacman -S python-mysql-connector python-pygit2 python-srcinfo python-sqlalchemy \
|
# pacman -S python-mysql-connector python-pygit2 python-srcinfo python-sqlalchemy \
|
||||||
python-bleach python-markdown python-alembic python-jinja \
|
python-bleach python-markdown python-alembic hypercorn \
|
||||||
python-itsdangerous python-authlib python-httpx hypercorn
|
python-itsdangerous python-authlib python-httpx
|
||||||
# python3 setup.py install
|
# python3 setup.py install
|
||||||
|
|
||||||
5) Create a new MySQL database and a user and import the aurweb SQL schema:
|
5) Create a new MySQL database and a user and import the aurweb SQL schema:
|
||||||
|
|
|
@ -19,12 +19,14 @@ Directory Layout
|
||||||
|
|
||||||
* `aurweb`: aurweb Python modules, Git interface and maintenance scripts
|
* `aurweb`: aurweb Python modules, Git interface and maintenance scripts
|
||||||
* `conf`: configuration and configuration templates
|
* `conf`: configuration and configuration templates
|
||||||
|
* `static`: static resource files
|
||||||
|
* `templates`: jinja2 template collection
|
||||||
* `doc`: project documentation
|
* `doc`: project documentation
|
||||||
* `po`: translation files for strings in the aurweb interface
|
* `po`: translation files for strings in the aurweb interface
|
||||||
* `schema`: schema for the SQL database
|
* `schema`: schema for the SQL database
|
||||||
* `test`: test suite and test cases
|
* `test`: test suite and test cases
|
||||||
* `upgrading`: instructions for upgrading setups from one release to another
|
* `upgrading`: instructions for upgrading setups from one release to another
|
||||||
* `web`: web interface for the AUR
|
* `web`: PHP-based web interface for the AUR
|
||||||
|
|
||||||
Links
|
Links
|
||||||
-----
|
-----
|
||||||
|
@ -46,3 +48,8 @@ Translations are welcome via our Transifex project at
|
||||||
https://www.transifex.com/lfleischer/aurweb; see `doc/i18n.txt` for details.
|
https://www.transifex.com/lfleischer/aurweb; see `doc/i18n.txt` for details.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
Testing
|
||||||
|
-------
|
||||||
|
|
||||||
|
See [test/README.md](test/README.md) for details on dependencies and testing.
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
Running tests
|
Running tests
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
To run all the tests, you may run `make check` under `test/`.
|
To run all tests, you may run `make check` under `test/` (alternative targets:
|
||||||
|
`make pytest`, `make sh`).
|
||||||
|
|
||||||
For more control, you may use the `prove` command, which receives a directory
|
For more control, you may use the `prove` or `pytest` command, which receives a
|
||||||
or a list of files to run, and produces a report.
|
directory or a list of files to run, and produces a report.
|
||||||
|
|
||||||
Each test script is standalone, so you may run them individually. Some tests
|
Each test script is standalone, so you may run them individually. Some tests
|
||||||
may receive command-line options to help debugging. See for example sharness's
|
may receive command-line options to help debugging. See for example sharness's
|
||||||
|
@ -22,16 +23,60 @@ For all the test to run, the following Arch packages should be installed:
|
||||||
- python-pygit2
|
- python-pygit2
|
||||||
- python-sqlalchemy
|
- python-sqlalchemy
|
||||||
- python-srcinfo
|
- python-srcinfo
|
||||||
|
- python-coverage
|
||||||
|
- python-pytest
|
||||||
|
- python-pytest-cov
|
||||||
|
- python-pytest-asyncio
|
||||||
|
|
||||||
|
Running tests
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Recommended method of running tests: `make check`.
|
||||||
|
|
||||||
|
First, setup the test configuration:
|
||||||
|
|
||||||
|
$ sed -r 's;YOUR_AUR_ROOT;$(pwd);g' conf/config.dev > conf/config
|
||||||
|
|
||||||
|
With those installed, one can run Python tests manually with any AUR config
|
||||||
|
specified by `AUR_CONFIG`:
|
||||||
|
|
||||||
|
$ AUR_CONFIG=conf/config coverage run --append /usr/bin/pytest test/
|
||||||
|
|
||||||
|
After tests are run (particularly, with `coverage run` included), one can
|
||||||
|
produce coverage reports.
|
||||||
|
|
||||||
|
# Print out a CLI coverage report.
|
||||||
|
$ coverage report
|
||||||
|
# Produce an HTML-based coverage report.
|
||||||
|
$ coverage html
|
||||||
|
|
||||||
|
When running `make -C test`, all tests ran will produce coverage data via
|
||||||
|
`coverage run --append`. After running `make -C test`, one can continue with
|
||||||
|
coverage reporting steps above. Running tests through `make` will test and
|
||||||
|
cover code ran by both aurweb scripts and our pytest collection.
|
||||||
|
|
||||||
Writing tests
|
Writing tests
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Test scripts must follow the Test Anything Protocol specification:
|
Shell test scripts must follow the Test Anything Protocol specification:
|
||||||
http://testanything.org/tap-specification.html
|
http://testanything.org/tap-specification.html
|
||||||
|
|
||||||
|
Python tests must be compatible with `pytest` and included in `pytest test/`
|
||||||
|
execution after setting up a configuration.
|
||||||
|
|
||||||
Tests must support being run from any directory. They may use $0 to determine
|
Tests must support being run from any directory. They may use $0 to determine
|
||||||
their location. Python scripts should expect aurweb to be installed and
|
their location. Python scripts should expect aurweb to be installed and
|
||||||
importable without toying with os.path or PYTHONPATH.
|
importable without toying with os.path or PYTHONPATH.
|
||||||
|
|
||||||
Tests written in shell should use sharness. In general, new tests should be
|
Tests written in shell should use sharness. In general, new tests should be
|
||||||
consistent with existing tests unless they have a good reason not to.
|
consistent with existing tests unless they have a good reason not to.
|
||||||
|
|
||||||
|
Debugging tests
|
||||||
|
---------------
|
||||||
|
|
||||||
|
By default, `make -C test` is quiet and does not print out verbose information
|
||||||
|
about tests being run. If a test is failing, one can look into verbose details
|
||||||
|
of sharness tests by executing them with the `--verbose` flag. Example:
|
||||||
|
`./t1100_git_auth.t --verbose`. This is particularly useful when tests happen
|
||||||
|
to fail in a remote continuous integration environment, where the reader does
|
||||||
|
not have complete access to the runner.
|
||||||
|
|
Loading…
Add table
Reference in a new issue