Unit testing module for table-like test, for Python 3.
For Python 2, check out [TableTest](https://github.com/horia141/tabletest).
Many unit tests, especially those for side-effect free functions, can be written like this:
```python
import unittest
class FooTest(unittest.TestCase):
TEST_CASES = [ case_1, case_2, ... ]
def test_all(self):
for test_case in TEST_CASES:
do something with test_case
```
If there are many test cases, they'll all appear as a single unit test in test runners. Furthermore,
the failure of one test will cause all others to fail. Finally, it might be hard to identify which
of the tests actually fail.
TableTest3 aims to solve this problem. Using it, we can rewrite the previous example as:
```python
import tabletest
class FooTest(tabletest3.TableTestCase):
TEST_CASES = [ case_1, case_2, ... ]
@tabletest3.tabletest(TEST_CASES)
def test_all(self, test_case):
do something with test_case
```
When the testrunner will run this class, it will now find one test for each test case. Each test
will basically invoke `tabletest` with a single test case.
The setup functions like this:
* You must define a `TEST_CASE` class variable which can be iterated as a sequence.
* You must define a single argumet test function which does the testing required for each
test case.
* Each element of `TEST_CASE` generates a test function, called `test_all_{xx}`, for the previous
example.
* Iteration order is not guaranteed and should not be depended on.
* All other `unittest.TestCase` behavior remains intact: `setUp` and `tearDown` methods, other test
methods etc.
* More than one test can be annotated with tabletests per test case.
* However, the name must starst with `test_`, so it is picked up by the runner.
## Installation ##
Installation is straightforward, via `pip`:
```bash
pip install tabletest3
```
## Development ##
Working on this project is pretty much standard Python development. Perhaps the most novel aspect is the usage of the [Bazel][bazel] build system. At the moment, only a `py_library` and a `py_test` are defined as build rules. Nevertheless, tests are run through [Bazel][bazel] rather than through regular invocation. To run the tests use:
```bash
bazel test //:tabletest3_test
```
To push a new version of the package to PyPi use:
```bash
bazel run //:tabletest3_upload -- --user=[pypi user] --pass=[pypi password]
```
## References ##
See [Tabletests][tabletests] and [How Tabletest Works][how-tabletest-works] for a longer introduction as well as a deep dive into the library.
[tabletests]: https://horia141.github.com/jekyll/update/2015/08/31/tabletests.html
[how-tabletest-works]: https://horia141.github.com/jekyll/update/2015/09/08/how-tabletest-works.html
[bazel]: http://bazel.io
Metadata
Release files for tabletest3 1.1.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 | Provenance | Actions |
|---|---|---|---|---|
| tabletest3-1.1.0.tar.gz | 3.3 kB | Without provenance | Details for tabletest3-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tabletest3-1.1.0-py2-none-any.whl | Python 2 | none | any | Details for tabletest3-1.1.0-py2-none-any.whl |
Total release size: 9.5 kB
Release files / tabletest3-1.1.0.tar.gz
| Download URL | tabletest3-1.1.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dadffd45a9e2e9ee80377a463ac224665dbeb449648e4fdd4ab868339f2442b
|
|
BLAKE2b-256 checksum How to use checksums |
95166a4c0f094f909991f79906b651c6654ddf975894092024ff21c4e64db4d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / tabletest3-1.1.0-py2-none-any.whl
| Download URL | tabletest3-1.1.0-py2-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
359e31c67be2c26b3a9bc7c72ec2234a52545faf6ee63438a5813b14f98b4025
|
|
BLAKE2b-256 checksum How to use checksums |
d6eb7601f6bc6013d875cf16d04811b0262d499c5093a057bad3f359d749f8a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for tabletest3 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.