Skip to main content

play mqtt

https://img.shields.io/pypi/v/play_mqtt.svg https://travis-ci.org/davidemoro/play_mqtt.svg?branch=develop Documentation Status https://codecov.io/gh/davidemoro/play_mqtt/branch/develop/graph/badge.svg

pytest-play support for MQTT support.

Thanks to play_mqtt you can test the integration between a mocked IoT device that sends commands on MQTT and a reactive web application with UI checks.

You can also build a simulator that generates messages for you.

More info and examples on:

Features

This project defines a new pytest-play command:

- provider: mqtt
  type: publish
  host: "$mqtt_host"
  port: $mqtt_port
  endpoint: "$mqtt_endpoint"
  payload: '{
    "endpoint": "$mqtt_endpoint",
    "payload": {
      "obj_id_L": [0],
      "bin_value": [77251432],
      "measure_id": [100],
      "measureType": ["float"],
      "start_time": 1514911926114
    },
    "host": "$mqtt_host",
    "provider": "mqtt",
    "type": "publish",
    "port": "$mqtt_port"}'

Subscribe command:

test_data:
  - data: ciao1
---
- provider: mqtt
  type: subscribe
  host: iot.eclipse.org
  port: 1883
  topic: "home/bedroom/light"
  name: "messages"
- provider: mqtt
  type: publish
  host: iot.eclipse.org
  port: 1883
  endpoint: "home/bedroom/light"
  payload: $data
- provider: python
  type: wait_until
  timeout: 6
  expression: 'len(variables["messages"]) == 1'
  poll: 0.1
  sub_commands: []
- provider: python
  type: assert
  expression: 'len(variables["messages"]) == 1'
- provider: python
  type: assert
  expression: 'variables["messages"][0] == "$data"'

Twitter

pytest-play tweets happens here:

Credits

This package was created with Cookiecutter and the cookiecutter-play-plugin (based on audreyr/cookiecutter-pypackage project template).

CHANGES

0.0.5 (2019-04-03)

  • Implement subscribe command

0.0.4 (2019-01-26)

  • Fix pypi README rendering (rif #7)

0.0.3 (2019-01-25)

  • Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)

  • No more payload parmeter is json encodable

0.0.2 (2018-01-10)

  • Commands accept kwargs now

0.0.1 (2018-01-04)

  • First release

Release files for play-mqtt 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for play-mqtt 0.0.5
File Size Uploaded
play_mqtt-0.0.5.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for play-mqtt 0.0.5
File Interpreter ABI Platform
play_mqtt-0.0.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size:24.4 kB

Release files / play_mqtt-0.0.5.tar.gz

Download URL play_mqtt-0.0.5.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
75c8a7483c142b85353fc4aea24fa5dc7140dbe3edc9d9a6af593994dcc31f17
BLAKE2b-256 checksum
How to use checksums
cdc2397b0a055492b96b34645da6d9fae6fc938b9ebace73b335438a025fda53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release files / play_mqtt-0.0.5-py2.py3-none-any.whl

Download URL play_mqtt-0.0.5-py2.py3-none-any.whl
Size 7.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0fb681d0a1e5a5d753846da6c518922e98ee650855ee8bbab24d5d131f3c7d73
BLAKE2b-256 checksum
How to use checksums
2bf3a74dfdd31b37d73b336530e076042596a00a66f89aad040c1ff03da17534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page