utknows
utknows is a unittest patch that can automaticly skip test case based on dependence info calculated by trace.
Installing
You can install utknows through pip or easy-install:
pip install utknows
Or you can download the latest development version, which may contain new features.
Using utknows
utknows should be used before unittest.main is invoked like this:
from utknows import setup_utknows setup_utknows(db, db_prefix="utknows", root_dir=os.path.abspath(os.curdir)) unittest.main(******, exit=False) # some resource release, etc db.close()
The db is a persistence database instance, and implementate __getitem__ and __setitem__ method.
The root_dir is the tracing base of dependence used by trace.
The db_prefix is the key prefix in db.
When the first time tests runs, it calculate all the dependence info of every testcase:
utknows/examples$ python alltests.py ...... ---------------------------------------------------------------------- Ran 6 tests in 0.031s OK
After that, the case will be skipped when the dependence info is satisfacted:
utknows/examples$ python alltests.py ssssss ---------------------------------------------------------------------- Ran 0 tests in 0.003s OK (skipped=6)
Case will be rerun after you modify any file it depends:
utknows/examples$ touch test_hello.py utknows/examples$ python alltests.py ...sss ---------------------------------------------------------------------- Ran 3 tests in 0.003s OK (skipped=3)
The s output here stand for skip.
Examples
Using redis as backend:
import redis
def open_db():
return redis.Redis(host='localhost', port=6379, db=0)
def close_db(db):
db.client_kill('localhost:6379')
from utknows import setup_utknows
db = open_db()
setup_utknows(db, root_dir=os.path.abspath(os.curdir))
unittest.main(defaultTest="suite", buffer=True, exit=False)
close_db(db)
Using dbm as backend:
import os
import shelve
def open_db():
return shelve.open(os.path.join(os.curdir, '.utknows'), writeback=True)
def close_db(db):
db.sync()
db.close()
from utknows import setup_utknows
db = open_db()
setup_utknows(db, root_dir=os.path.abspath(os.curdir))
unittest.main(defaultTest="suite", buffer=True, exit=False)
close_db(db)
License
utknows is copyright 2013 mapix and Contributors, and is made available under BSD-style license; see LICENSE for details.
Metadata
Release files for utknows 0.1.1
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 | |
|---|---|---|---|---|
| utknows-0.1.1.tar.gz | 2.9 kB | Without provenance | Details |
Release files / utknows-0.1.1.tar.gz
| Download URL | utknows-0.1.1.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc47d1cf8384393813cea495537c8753e984f6386f075d3ac3127ddb9d6f7ccc
|
|
BLAKE2b-256 checksum How to use checksums |
9d523a9ab3d4b865dad275e750d084ab2f9d5a2fa2d3225757eda45f7743c96f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for utknows 0.1.1
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.