tests: use pytest instead of unittest

pytest provides session scoped fixtures, making it much easier
to reuse resources across tests.
This commit is contained in:
Lucian Petrut
2026-09-07 11:52:46 +00:00
parent 4ddf0c015d
commit 1e9c2816ef
15 changed files with 403 additions and 454 deletions
+1 -1
View File
@@ -251,7 +251,7 @@ hard-coding the lab certificate.
Run:
```bash
.venv/bin/python -m unittest tests.integration.test_nfc_auth
.venv/bin/pytest tests/integration/test_nfc_auth.py
```
The test completes VIM login and the authd handshake (`200 Connect`)
+1 -1
View File
@@ -206,7 +206,7 @@ classic type 4 `NFC_SESSION_COMPLETE`.
Run:
```bash
.venv/bin/python -m unittest tests.integration.test_nfc_open
.venv/bin/pytest tests/integration/test_nfc_open.py
```
The test opens the temporary lab VMDK, asserts an opaque handle and
+1 -1
View File
@@ -105,7 +105,7 @@ Writes use the same 44-byte IO payload with opcode `2`; see
`openvixdisklib/nfc_open.py`. Run:
```bash
.venv/bin/python -m unittest tests.integration.test_nfc_read_write
.venv/bin/pytest tests/integration/test_nfc_read_write.py
```
The integration test writes and then reads the captured VDDK ranges
+3 -3
View File
@@ -9,9 +9,9 @@ NFC work can follow the same loop instead of rediscovering it.
Scope so far: `VixDiskLib_ConnectEx` + `VixDiskLib_Open` +
`VixDiskLib_Read` + `VixDiskLib_Write` against lab vCenter 8.0.1 /
ESXi 8, transport `nbd`. Driver: `tests/integration/` (`TestBase`
creates a temporary empty VM with a 10 GiB disk in `setUpClass` and
destroys it in `tearDownClass`).
ESXi 8, transport `nbd`. Driver: `tests/integration/` (the session-scoped
`lab` fixture creates a temporary empty VM with a 10 GiB disk and
destroys it when the pytest session ends).
Rule from `AGENTS.md`: reuse pyVmomi for every public VIM operation.
Only reimplement what pyVmomi does not expose.