A helper for testing output of a process in tests.
Installing
$ pip install what
Usage
>>> from what import What
>>> w = What('echo', 'hello world')
>>> w.expect('hello')
'hello world'
>>> w.expect('unicorns', timeout=1)
>>> # ... tracback here ...
what.exceptions.EOF: End of file is reached while expecting string
Expected: unicorns
Return code: 0
Timed out: False
Last 100 lines:
======================================================================
hello world
>>> w.expect_exit(0)
Changes
0.5.0: Add support for Python 3.
0.4.4: Changed WhatError to inherit from AssertionError in order to be compatible with unittest.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
What-0.5.0.tar.gz
(7.2 kB
view details)
File details
Details for the file What-0.5.0.tar.gz.
File metadata
- Download URL: What-0.5.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a3fa57bdbd7dd93b3e6c6961aeffa10edcfe7997adc6c3cabab7a16660b45d
|
|
| MD5 |
8ed90251617db67ab38b72c15b92b08b
|
|
| BLAKE2b-256 |
16b9140483972e4a93104a9041a7a0efe956f2766105338aec6f4f01530fe717
|