remove nose dependencies
This commit is contained in:
parent
841b7a0674
commit
1ce5b1f87a
@ -52,7 +52,6 @@ We use basically standard rst-docstrings for Sphinx.
|
|||||||
Test
|
Test
|
||||||
^^^^
|
^^^^
|
||||||
Try to write tests whenever possible. Our goal for the future is 100% coverage.
|
Try to write tests whenever possible. Our goal for the future is 100% coverage.
|
||||||
We are currently using `nose` but might change in the future.
|
|
||||||
You can copy the structure from other testcases. Please remember to adapt the docstrings.
|
You can copy the structure from other testcases. Please remember to adapt the docstrings.
|
||||||
|
|
||||||
Further reading
|
Further reading
|
||||||
|
@ -56,17 +56,12 @@ tests_require =
|
|||||||
pytest!=3.2.0,!=3.3.0
|
pytest!=3.2.0,!=3.3.0
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-mock
|
pytest-mock
|
||||||
nose
|
|
||||||
scripttest
|
scripttest
|
||||||
mock
|
mock
|
||||||
hypothesis>4
|
hypothesis>4
|
||||||
flake8
|
flake8
|
||||||
sphinxcontrib-spelling>=7.2.0
|
sphinxcontrib-spelling>=7.2.0
|
||||||
|
|
||||||
[nosetests]
|
|
||||||
verbosity=3
|
|
||||||
with-doctest=1
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from nose.tools import assert_raises
|
|
||||||
from escpos.printer import Dummy
|
from escpos.printer import Dummy
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from nose.tools import raises
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import escpos.printer as printer
|
import escpos.printer as printer
|
||||||
@ -66,25 +65,25 @@ def test_model():
|
|||||||
assert instance.output == expected
|
assert instance.output == expected
|
||||||
|
|
||||||
|
|
||||||
@raises(ValueError)
|
|
||||||
def test_invalid_ec():
|
def test_invalid_ec():
|
||||||
"""Test invalid QR error correction"""
|
"""Test invalid QR error correction"""
|
||||||
instance = printer.Dummy()
|
instance = printer.Dummy()
|
||||||
instance.qr("1234", native=True, ec=-1)
|
with pytest.raises(ValueError):
|
||||||
|
instance.qr("1234", native=True, ec=-1)
|
||||||
|
|
||||||
|
|
||||||
@raises(ValueError)
|
|
||||||
def test_invalid_size():
|
def test_invalid_size():
|
||||||
"""Test invalid QR size"""
|
"""Test invalid QR size"""
|
||||||
instance = printer.Dummy()
|
instance = printer.Dummy()
|
||||||
instance.qr("1234", native=True, size=0)
|
with pytest.raises(ValueError):
|
||||||
|
instance.qr("1234", native=True, size=0)
|
||||||
|
|
||||||
|
|
||||||
@raises(ValueError)
|
|
||||||
def test_invalid_model():
|
def test_invalid_model():
|
||||||
"""Test invalid QR model"""
|
"""Test invalid QR model"""
|
||||||
instance = printer.Dummy()
|
instance = printer.Dummy()
|
||||||
instance.qr("1234", native=True, model="Hello")
|
with pytest.raises(ValueError):
|
||||||
|
instance.qr("1234", native=True, model="Hello")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip("this test has to be debugged")
|
@pytest.mark.skip("this test has to be debugged")
|
||||||
@ -103,11 +102,11 @@ def test_image():
|
|||||||
assert instance.output == expected
|
assert instance.output == expected
|
||||||
|
|
||||||
|
|
||||||
@raises(ValueError)
|
|
||||||
def test_image_invalid_model():
|
def test_image_invalid_model():
|
||||||
"""Test unsupported QR model as image"""
|
"""Test unsupported QR model as image"""
|
||||||
instance = printer.Dummy()
|
instance = printer.Dummy()
|
||||||
instance.qr("1234", native=False, model=QR_MODEL_1)
|
with pytest.raises(ValueError):
|
||||||
|
instance.qr("1234", native=False, model=QR_MODEL_1)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from nose.tools import assert_raises
|
import pytest
|
||||||
from escpos.printer import Dummy
|
from escpos.printer import Dummy
|
||||||
|
|
||||||
|
|
||||||
@ -16,11 +16,11 @@ def test_line_spacing_rest():
|
|||||||
|
|
||||||
def test_line_spacing_error_handling():
|
def test_line_spacing_error_handling():
|
||||||
printer = Dummy()
|
printer = Dummy()
|
||||||
with assert_raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
printer.line_spacing(99, divisor=44)
|
printer.line_spacing(99, divisor=44)
|
||||||
with assert_raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
printer.line_spacing(divisor=80, spacing=86)
|
printer.line_spacing(divisor=80, spacing=86)
|
||||||
with assert_raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
printer.line_spacing(divisor=360, spacing=256)
|
printer.line_spacing(divisor=360, spacing=256)
|
||||||
with assert_raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
printer.line_spacing(divisor=180, spacing=256)
|
printer.line_spacing(divisor=180, spacing=256)
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from nose.tools import raises, assert_raises
|
|
||||||
from hypothesis import given, example
|
from hypothesis import given, example
|
||||||
import hypothesis.strategies as st
|
import hypothesis.strategies as st
|
||||||
from escpos.magicencode import MagicEncode, Encoder
|
from escpos.magicencode import MagicEncode, Encoder
|
||||||
@ -32,9 +31,9 @@ class TestEncoder:
|
|||||||
assert not Encoder({"CP437": 1}).find_suitable_encoding("€")
|
assert not Encoder({"CP437": 1}).find_suitable_encoding("€")
|
||||||
assert Encoder({"CP858": 1}).find_suitable_encoding("€") == "CP858"
|
assert Encoder({"CP858": 1}).find_suitable_encoding("€") == "CP858"
|
||||||
|
|
||||||
@raises(ValueError)
|
|
||||||
def test_get_encoding(self):
|
def test_get_encoding(self):
|
||||||
Encoder({}).get_encoding_name("latin1")
|
with pytest.raises(ValueError):
|
||||||
|
Encoder({}).get_encoding_name("latin1")
|
||||||
|
|
||||||
|
|
||||||
class TestMagicEncode:
|
class TestMagicEncode:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user