diff --git a/.editorconfig b/.editorconfig index dc806e6..d9c54e2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,3 +16,6 @@ indent_style = space [*.{yaml,yml,md}] indent_size = 2 + +[.vscode/*.json] +insert_final_newline = false diff --git a/.vscode/settings.json b/.vscode/settings.json index 1295ee6..2148ad5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,8 @@ { - "editor.formatOnSave": true -} + "editor.formatOnSave": true, + "pylint.args": [ + "--disable=missing-function-docstring,missing-class-docstring,missing-module-docstring" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/tests/test_protocol.py b/tests/test_protocol.py new file mode 100644 index 0000000..f375394 --- /dev/null +++ b/tests/test_protocol.py @@ -0,0 +1,11 @@ +from io import BytesIO + +from srnemqtt.protocol import write as protocol_write + + +def test_write(): + fh = BytesIO() + protocol_write(fh, b"Hello, World!") + fh.seek(0) + + assert fh.read() == b"Hello, World!\x4E\x11" diff --git a/tox.ini b/tox.ini index edfab12..8a5a3ef 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,7 @@ [flake8] max-line-length = 88 extend-ignore = E203, I201, I101 + +[pytest] +pythonpath = . +testpaths = tests