in use in a number of projects with large test cases. You might want to checkout
"nose" or "unittest2" first. :) Some features include:
- small, you can just put this one file in your "test" dir
- no external dependencies other than the stdlib
- tagging of individual and groups of tests to allow easily running test
subsets (can be very helpful in huge doc sets)
- support for "TestSkipped" as a return from a test (TODO: has modern
unittest.py added this now?). This is helpful for tests of platform-dependent
or optional features.
# Usage
A typical Python project setup (at least for me) is:
foo/ # project foo
README.md
setup.py
lib/
foo.py # the main code of the project
test/
testlib.py # the testlib.py from *this project*
test.py # a small stub driver
test_foo.py # an actual test file with TestCase's
test_bar.py # another test file
Minimally the "test.py" driver is:
import sys, os
import testlib
# Put the 'lib' dir on sys.path.
sys.path.insert(0, join(dirname(dirname(abspath(__file__))), "lib"))
sys.exit(testlib.harness())
Then you run:
cd test
python test.py
The test harness will find all TestCase classes in all "test_*.py" files and
run them. Tagging support allows you to run subsets of the full test suite:
python test.py foo # Just run tests in "test_foo.py"
python test.py bar # ... just in "test_bar.py"
If "test_bar.py" looked something like this:
import unittest
from testlib import tag
class BlahTestCase(unittest.TestCase):
@tag("question")
def test_whozit(self):
...
@tag("question")
def test_whatzit(self):
...
def test_thatzit(self):
...
The then following would be possible:
python test.py blah # run all tests in `BlahTestCase`
python test.py question # run all tests tagged "question"
python test.py -- -question # run all test *except* those tagged "question"
python test.py whozit # run just `BlahTestCase.test_whozit`
See "Naming and Tagging" below for more details.
# Example Output
TODO
# Naming and Tagging
TODO
# Gathering from Multiple Test Directories
TODO
# Real-world examples
- [openkomodo](http://svn.openkomodo.com/openkomodo/view/openkomodo/trunk/test/test.py): the code for Komodo IDE and Edit
- [python-markdown2](http://code.google.com/p/python-markdown2/source/browse/#svn/trunk/test)
Metadata
Release files for testlib 0.6.5
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 |
|---|---|---|---|---|
| testlib-0.6.5.zip | 16.3 kB | Without provenance | Details for testlib-0.6.5.zip |
Release files / testlib-0.6.5.zip
| Download URL | testlib-0.6.5.zip |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ec84a56a98a8e45dbb60900c4660ec317f085dc15d80cf65b0b75623b33e2d7
|
|
BLAKE2b-256 checksum How to use checksums |
17940688329215ba098e55913d861507abed2b2a586a6376d9216d93042cce13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for testlib 0.6.5
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.