testhide-unittest-plugin
Emit Testhide-format (JUnit-extended) test reports straight from Python's built-in
unittest — so the Testhide build agent
parses your results correctly and the dashboard/AI features get full data, with zero manual XML.
It produces the exact same contract as
testhide-pytest-plugin: fail_id,
test_resolution, docstr/attachment/info/jira properties, <system-out>, suite
metadata, and testhide_schema_version=1. See the canonical spec:
Testhide Report Format v1.
Install
pip install testhide-unittest-plugin
# optional Jira enrichment:
pip install "testhide-unittest-plugin[jira]"
Usage
CLI (recommended) — a thin wrapper over unittest
# discover & run, writing the report:
python -m testhide_unittest discover -s tests -p "test_*.py" --report-xml junittests.xml
# run specific modules/classes:
python -m testhide_unittest tests.test_login --report-xml junittests.xml
Anything unittest accepts is passed through; Testhide options are consumed by the wrapper:
| Option | Meaning |
|---|---|
--report-xml PATH |
output report (default junittests.xml) |
--suite-name NAME |
<testsuite name="..."> (default unittest) |
--quarantine-file PATH |
skip listed test ids (also TESTHIDE_QUARANTINE_FILE / .testhide_quarantine_file) |
--meta KEY=VALUE |
add a suite <property> (repeatable; e.g. --meta build=1042 --meta branch=main) |
--no-capture |
do not capture stdout/stderr into <system-out> |
--jira-url / --jira-username / --jira-password |
optional Jira enrichment by fail_id |
Exit code is 0 when all tests pass, 1 otherwise — drop it straight into CI.
Programmatic
import unittest
import testhide_unittest
runner = testhide_unittest.TesthideTestRunner(
report_path="junittests.xml",
metadata={"build": "1042", "branch": "main"},
)
unittest.main(testRunner=runner)
Enrich a test's report entry
import unittest
import testhide_unittest as th
class LoginTests(unittest.TestCase):
def test_login(self):
"User can log in with valid credentials." # docstring -> docstr (automatic)
th.attach("/tmp/screenshot.png") # repeatable; images/logs/json
th.set_info('{"env": "staging"}') # free-form context
th.set_jira("PROJ-123") # link a ticket
...
What it captures
- Outcomes: pass / fail / error / skip /
@expectedFailure(→Known Issue) / unexpected pass. fail_id=md5("module.class.function.ExceptionType(message)")— stable failure key for dedup + Jira linkage (identical to the pytest plugin).file/line(for code-impact matching), test duration, docstring, attachments, info, jira, and captured stdout/stderr in<system-out>.- Suite metadata: hostname, ip,
testhide_schema_version, plus your--metaproperties.
Parallel / sharded runs
The writer is parallel-safe: each test is written to a temp chunk under .{report}_temp/, then
atomically merged into the final report (file-locked). Counts are recomputed on merge.
Conformance
conformance/ vendors the canonical validator + golden fixture. CI runs the plugin against a
sample suite and validates the output, guaranteeing the agent will parse it:
python conformance/validate_report.py junittests.xml
Publishing (maintainers)
Local publish (Windows):
copy .env.local.example .env.local :: then edit .env.local and add PYPI_API_TOKEN
publish.bat
publish.bat loads .env.local (gitignored), runs the conformance tests, builds the
sdist + wheel, and uploads to PyPI with twine.
.env.local:
PYPI_API_TOKEN=pypi-... # https://pypi.org/manage/account/token/
CI publish (GitHub Actions): pushing to main auto-publishes (conformance gate → patch
version bump → PyPI → GitHub Release; loop-guarded so the bump commit doesn't re-trigger).
Required repository secret:
PYPI_API_TOKEN— PyPI API token (Settings → Secrets and variables → Actions).
License
MIT.
Metadata
Release files for testhide-unittest-plugin 0.1.4
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 |
|---|---|---|---|---|
| testhide_unittest_plugin-0.1.4.tar.gz | 16.5 kB | Without provenance | Details for testhide_unittest_plugin-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| testhide_unittest_plugin-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for testhide_unittest_plugin-0.1.4-py3-none-any.whl |
Total release size: 32.8 kB
Release files / testhide_unittest_plugin-0.1.4.tar.gz
| Download URL | testhide_unittest_plugin-0.1.4.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a20593195feeab4cc640be1a9defec3c428f72640054c9e9303e16b08abcae6
|
|
BLAKE2b-256 checksum How to use checksums |
4a4022a8a3f66e05c5a9568d2a7104bf6083de4e28f2a12f19c74538e671ee59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / testhide_unittest_plugin-0.1.4-py3-none-any.whl
| Download URL | testhide_unittest_plugin-0.1.4-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e0f55556a1b0bfdd87e4a49c246b8ec036862870f8a5d2d6b26a1cf885d5966
|
|
BLAKE2b-256 checksum How to use checksums |
8f0169c14dba8e6ae6d751557dc8bca316e34383bcfc836da9cdfb3e7fd096f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for testhide-unittest-plugin 0.1.4
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.