Lily unit test package for Python
This package aims to be a full alternative to the Python’s build-in unittest package. This package has the following features:
Test suite class with various build-in functions.
Test runner that scans all Python files in your project for test suites and executes them.
Single page HTML report: test report latest release.
Text log file of every test suite that was executed.
The package is available on PyPi.
Installation
Install the package from PyPi:
pip install lily-unit-test
Usage
The following example shows a basic test suite for your python code:
# Import the package
import lily_unit_test
# Some functions that needs testing
def add_one(x):
return x + 1
def add_two(x):
return x + 2
# Simply make a sub class of the lily unit test test suite
class MyTestSuite(lily_unit_test.TestSuite):
def test_add_one(self):
self.fail_if(add_one(3) != 4, "Wrong return value")
def test_add_two(self):
self.fail_if(add_two(3) != 5, "Wrong return value")
if __name__ == "__main__":
# Run the test suite
MyTestSuite().run()
Run the Python file, the output should look like this:
2023-12-20 19:28:46.105 | INFO | Run test suite: MyTestSuite
2023-12-20 19:28:46.105 | INFO | Run test case: MyTestSuite.test_add_one
2023-12-20 19:28:46.106 | INFO | Test case MyTestSuite.test_add_one: PASSED
2023-12-20 19:28:46.106 | INFO | Run test case: MyTestSuite.test_add_two
2023-12-20 19:28:46.106 | INFO | Test case MyTestSuite.test_add_two: PASSED
2023-12-20 19:28:46.106 | INFO | Test suite MyTestSuite: 2 of 2 test cases passed (100.0%)
2023-12-20 19:28:46.106 | INFO | Test suite MyTestSuite: PASSED
A test runner is included that runs all test suites in a folder:
from lily_unit_test import TestRunner
TestRunner.run("path/to/test_suites")
The test runner scans the folder recursively for Python files containing a test suite class.
Created and owned by Danny van der Pol, LilyTronics
Metadata
Release files for lily-unit-test 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lily_unit_test-1.10.0.tar.gz | 20.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lily_unit_test-1.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.1 kB
Release files / lily_unit_test-1.10.0.tar.gz
| Download URL | lily_unit_test-1.10.0.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
192f50897d7e8508918ec62b779f8bb0a9012ad05ff459a968ce42196c6603d1
|
|
BLAKE2b-256 checksum How to use checksums |
07980b7605949db98124dc24b6bbc73292b96a8a450fa71253585e07ec1d34bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.11
|
Release files / lily_unit_test-1.10.0-py3-none-any.whl
| Download URL | lily_unit_test-1.10.0-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b78cda74423ebea66fc358abb5db06a3408696d48c6b3660c3715886e3abb448
|
|
BLAKE2b-256 checksum How to use checksums |
7084a94308a683d309c7c804ac5380cec1b702f393f2f27cf0695f5ac982a28c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.11
|