
Drops Py3.7, improves typing and adds a mypy config, improves the docstrings and isorts the imports. * configure isort * sort with isort * add github action * enable flake8-docstrings * fix docstrings * add mypy env * no implicit optional * add type for raw * add some type hints
27 lines
598 B
Python
27 lines
598 B
Python
#!/usr/bin/python
|
|
|
|
import socket
|
|
|
|
import mock
|
|
import pytest
|
|
|
|
import escpos.printer as printer
|
|
|
|
|
|
@pytest.fixture
|
|
def instance():
|
|
socket.socket.connect = mock.Mock()
|
|
return printer.Network("localhost")
|
|
|
|
|
|
def test_close_without_open(instance):
|
|
"""try to close without opening (should fail gracefully)
|
|
|
|
Currently we never open from our fixture, so calling close once
|
|
should be enough. In the future this might not be enough,
|
|
therefore we have to close twice in order to provoke an error
|
|
(if possible, this should not raise)
|
|
"""
|
|
instance.close()
|
|
instance.close()
|