Important note: Python tests will repeatedly clear out tables that they test against; for this reason, one should always run the shell tests first. The __init__.py file is necessary for coverage to collect data from the tests being run. At this point in FastAPI development, I'd like to encourage a few things going forward: 1. Any time you contribute to the FastAPI codebase, you **must** maintain equal or increased coverage on the overall source. Developers are highly appreciated for adding tests in your specific domain of addition or modification that may be missing coverage. Our goal is 100% coverage, and all newly added files **must** have 100% coverage through tests. 2. All source should be formatted with the autopep8 tool and kept within an 80 column width, with the exception of HTML templates. Signed-off-by: Kevin Morris <kevr@0cost.org> |
||
---|---|---|
.. | ||
scripts | ||
Makefile | ||
README.md | ||
setup.sh | ||
sharness.sh | ||
t1100-git-auth.t | ||
t1200-git-serve.t | ||
t1300-git-update.t | ||
t2100-mkpkglists.t | ||
t2200-tuvotereminder.t | ||
t2300-pkgmaint.t | ||
t2400-aurblup.t | ||
t2500-notify.t | ||
t2600-rendercomment.t | ||
t2700-usermaint.t |
Running tests
To run all the tests, you may run make check
under test/
.
For more control, you may use the prove
command, which receives a 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 may receive command-line options to help debugging. See for example sharness's documentation for shell test scripts: https://github.com/chriscool/sharness/blob/master/README.git
Dependencies
For all the test to run, the following Arch packages should be installed:
- pyalpm
- python-alembic
- python-bleach
- python-markdown
- python-pygit2
- python-sqlalchemy
- python-srcinfo
Writing tests
Test scripts must follow the Test Anything Protocol specification: http://testanything.org/tap-specification.html
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 importable without toying with os.path or PYTHONPATH.
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.