A simple network listener
Project description
Simple JSON listener using TCP that listens for data and stores it in a queue for later retrieval.
Installation
Install using your favourite package manager:
pip install pytest-listener
# or..
easy_install pytest-listener
Enable the fixture explicitly in your tests or conftest.py (not required when using setuptools entry points):
pytest_plugins = ['pytest_listener']
Basic Test Usage
Here’s a test showing the basic functionality:
def test_listener(listener):
data1 = {'foo': 1}
listener.send(some_data)
data2 = {'bar': 2}
listener.send(some_data)
assert listener.receive() == data1
assert listener.receive() == data2
data3 = {'baz': 3}
listener.send(some_data)
# Clear the listening queue - this deletes data3
listener.clear_queue()
data2 = {'qux': 4}
listener.send(some_data)
assert listener.recieve() == data3
Changelog
1.0.1 (2015-12-23)
Packaging bugfix
1.0.0 (2015-12-21)
Initial public release
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
pytest-listener-1.0.1.tar.gz
(5.1 kB
view hashes)
Built Distributions
Close
Hashes for pytest_listener-1.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33090e1e71704d0681f6350d7a9856ce151dc7ce62e6175a9e242aca3f24d53a |
|
MD5 | 33dcf70fb0c30147a347b796ebee9b48 |
|
BLAKE2b-256 | f008aa78908ccbb1e20471c53d0aca9899c4481b63bad4b898046bc8d5676143 |