diff --git a/test/test_printer_file.py b/test/test_printer_file.py deleted file mode 100644 index dcda627..0000000 --- a/test/test_printer_file.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -"""tests for the File printer - -:author: `Patrick Kanzler `_ -:organization: `python-escpos `_ -:copyright: Copyright (c) 2016 `python-escpos `_ -:license: MIT -""" - - -import pytest -import six -from hypothesis import given, settings -from hypothesis.strategies import text - -import escpos.printer as printer - -if six.PY3: - mock_open_call = "builtins.open" -else: - mock_open_call = "__builtin__.open" - - -@pytest.mark.skip("this test is broken and has to be fixed or discarded") -@given(path=text()) -def test_load_file_printer(mocker, path): - """test the loading of the file-printer""" - mock_escpos = mocker.patch("escpos.escpos.Escpos.__init__") - mock_open = mocker.patch(mock_open_call) - printer.File(devfile=path) - assert mock_escpos.called - mock_open.assert_called_with(path, "wb") - - -@pytest.mark.skip("this test is broken and has to be fixed or discarded") -@given(txt=text()) -def test_auto_flush(mocker, txt): - """test auto_flush in file-printer""" - mock_escpos = mocker.patch("escpos.escpos.Escpos.__init__") - mock_open = mocker.patch(mock_open_call) - mock_device = mocker.patch.object(printer.File, "device") - - p = printer.File(auto_flush=False) - # inject the mocked device-object - p.device = mock_device - p._raw(txt) - assert not mock_device.flush.called - mock_device.reset_mock() - p = printer.File(auto_flush=True) - # inject the mocked device-object - p.device = mock_device - p._raw(txt) - assert mock_device.flush.called - - -@pytest.mark.skip("this test is broken and has to be fixed or discarded") -@given(txt=text()) -def test_flush_on_close(mocker, txt): - """test flush on close in file-printer""" - mock_open = mocker.patch(mock_open_call) - mock_device = mocker.patch.object(printer.File, "device") - - p = printer.File(auto_flush=False) - # inject the mocked device-object - p.device = mock_device - p._raw(txt) - assert not mock_device.flush.called - p.close() - assert mock_device.flush.called - assert mock_device.close.called diff --git a/test/test_printer_network.py b/test/test_printer_network.py deleted file mode 100644 index 162d5f6..0000000 --- a/test/test_printer_network.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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()