Overview
swarmauri_tests_loc_tersity is a pytest plugin that
keeps modules small and readable. It scans a package for Python files and
asserts that each file stays under a configurable line‑of‑code (LOC) limit
(docstrings included). The default limit is 400 lines.
The plugin runs in parameterized mode by default, turning every file into an individual test case. You can also switch to an aggregate mode that reports all failures as a single test.
Installation
pip install swarmauri_tests_loc_tersity
pytest automatically discovers the plugin once it is installed.
Usage
Parameterized (default)
Run pytest normally to create one LOC check per Python file:
pytest
Example failure:
E AssertionError: pkg/example.py has 425 lines (>400)
Aggregate
Use the --loc-mode=aggregate flag to consolidate checks into one test that
lists every file exceeding the threshold:
pytest --loc-mode=aggregate
Example output:
E pkg/example.py has 425 lines (>400)
E pkg/other.py has 410 lines (>400)
Customizing
--loc-root PATH– directory to scan (defaults to the package root)--loc-max-lines N– change the maximum line count
pytest --loc-root=src --loc-max-lines=200
License
Licensed under the Apache 2.0 License.
Metadata
Release files for swarmauri_tests_loc_tersity 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tests_loc_tersity-0.1.2.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tests_loc_tersity-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / swarmauri_tests_loc_tersity-0.1.2.tar.gz
| Download URL | swarmauri_tests_loc_tersity-0.1.2.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05e9db784ac524c9d392ef08e3b998c21171bbe1a6400ccc3b33bfe64124cc99
|
|
BLAKE2b-256 checksum How to use checksums |
80daf67982b2e4805c2fb2b95cda89f57ce1419e297a2912d97b006b54a68dad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tests_loc_tersity-0.1.2-py3-none-any.whl
| Download URL | swarmauri_tests_loc_tersity-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad575e92402f95e80c4b733a9f118e683ef57af7f9409625717fc3aa8d370dae
|
|
BLAKE2b-256 checksum How to use checksums |
6dcc037a62f9523d6492f84ac1ee39e40c346090c8c9709723e872706b572751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|