Python test by send / expect.
Project description
Python test drive utility
A nifty utility to test things.
The test case file drives a send / expect engine. The expect is then evaluated and the result is printed in a green colored 'OK' or a red colored 'ERR'.
./testvdrive.py testcase.txt
If you installed from pip, use:
testvdrive testcase.txt
The test case file contains the test instructions, one line per test. The format:
# Context_string Send_string Expect_string Find/Compare
# -------------- ----------- ------------- ------------
# for the user what to test what to expect True if Find
Example test cases:
[ "Echo Command", "", "", True], # NOOP
[ "Test ls", "ls", "Make", True], # Do we have a Make file
[ "DF command", "df", "blocks", "regex" ], # Search regex
[ "DF mregex", "df", ".*blo", "mregex" ], # Match regex
The output of example test cases (colored in terminal):
Echo Command OK
Test ls OK
DF command OK
DF mregex OK
Help from command line:
usage: testvdrive [-h] [-V] [-o] [-A] [-v] [-d DEBUGLEV] [-l FILL] [-s]
[test_cases ...]
Test with send/expect by executing sub commands from test case scripts.
positional arguments:
test_cases Test case file names to execute
options:
-h, --help show this help message and exit
-V, --version Show version number
-o, --outp Show communication with program
-A, --info Show testcase file format info
-v, --verbose increase verbocity (Default: none)
-d DEBUGLEV, --debug DEBUGLEV
Debug value (0-9). Show working info. Default: 0
-l FILL, --fill FILL Fill info string to lenght. Default: 16
-s, --show_case Show test case file(s).
For info on TestCase File Format use -A option. The file 'testcase.txt' is
executed by default.
Git
The source can be found on:
https://github.com/pglen/testvdrive
History:
Mon 22.Sep.2025 converted to text interaction from popen2
Wed 24.Sep.2025 return code now on pip install as well
// EOF
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
testvdrive-1.3.2.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file testvdrive-1.3.2.tar.gz.
File metadata
- Download URL: testvdrive-1.3.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feb0712ec33867406f37f9cc0051cc35544175ec3a79f7a2b2489d5ef6fe810d
|
|
| MD5 |
a629a96dd9cef8b6ef61a34159e2a4f4
|
|
| BLAKE2b-256 |
10c76026de868e75c487c3310784b9f8a887259adf09c825e1119f52505062d0
|
File details
Details for the file testvdrive-1.3.2-py3-none-any.whl.
File metadata
- Download URL: testvdrive-1.3.2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab3c76fdf7fb398f9c0375ec03a4a395fa1225a9b1d9bd90de57b8062694c705
|
|
| MD5 |
a46a1f610013c15278693d0ffdfc45bf
|
|
| BLAKE2b-256 |
6e444f57882da7cad47d0c1e793b65195d343d164a25be7d63958883ea007f01
|