Configure pytest
This commit is contained in:
parent
7977d89abf
commit
3c8942b485
4 changed files with 25 additions and 2 deletions
|
@ -16,3 +16,6 @@ indent_style = space
|
||||||
|
|
||||||
[*.{yaml,yml,md}]
|
[*.{yaml,yml,md}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
[.vscode/*.json]
|
||||||
|
insert_final_newline = false
|
||||||
|
|
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
|
@ -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
|
||||||
|
}
|
11
tests/test_protocol.py
Normal file
11
tests/test_protocol.py
Normal file
|
@ -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"
|
4
tox.ini
4
tox.ini
|
@ -1,3 +1,7 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 88
|
max-line-length = 88
|
||||||
extend-ignore = E203, I201, I101
|
extend-ignore = E203, I201, I101
|
||||||
|
|
||||||
|
[pytest]
|
||||||
|
pythonpath = .
|
||||||
|
testpaths = tests
|
||||||
|
|
Loading…
Reference in a new issue