mirror of
https://github.com/python-escpos/python-escpos
synced 2025-12-02 09:43:30 +00:00
pyflakes3
This commit is contained in:
@@ -7,7 +7,6 @@ import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
from scripttest import TestFileEnvironment as TFE
|
||||
|
||||
import escpos
|
||||
@@ -31,18 +30,18 @@ class TestCLI:
|
||||
"""Contains setups, teardowns, and tests for CLI"""
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
def setup_class(cls) -> None:
|
||||
"""Create a config file to read from"""
|
||||
with open(CONFIGFILE, "w") as config:
|
||||
config.write(CONFIG_YAML)
|
||||
|
||||
@classmethod
|
||||
def teardown_class(cls):
|
||||
def teardown_class(cls) -> None:
|
||||
"""Remove config file"""
|
||||
os.remove(CONFIGFILE)
|
||||
shutil.rmtree(TEST_DIR)
|
||||
|
||||
def setup_method(self):
|
||||
def setup_method(self) -> None:
|
||||
"""Create a file to print to and set up env"""
|
||||
self.env = None
|
||||
self.default_args = None
|
||||
@@ -64,24 +63,24 @@ class TestCLI:
|
||||
finally:
|
||||
fhandle.close()
|
||||
|
||||
def teardown_method(self):
|
||||
def teardown_method(self) -> None:
|
||||
"""Destroy printer file and env"""
|
||||
os.remove(DEVFILE)
|
||||
self.env.clear()
|
||||
|
||||
def test_cli_help(self):
|
||||
def test_cli_help(self) -> None:
|
||||
"""Test getting help from cli"""
|
||||
result = self.env.run("python-escpos", "-h")
|
||||
assert not result.stderr
|
||||
assert "usage" in result.stdout
|
||||
|
||||
def test_cli_version(self):
|
||||
def test_cli_version(self) -> None:
|
||||
"""Test the version string"""
|
||||
result = self.env.run("python-escpos", "version")
|
||||
assert not result.stderr
|
||||
assert escpos.__version__ == result.stdout.strip()
|
||||
|
||||
def test_cli_version_extended(self):
|
||||
def test_cli_version_extended(self) -> None:
|
||||
"""Test the extended version information"""
|
||||
result = self.env.run("python-escpos", "version_extended")
|
||||
assert not result.stderr
|
||||
@@ -89,7 +88,7 @@ class TestCLI:
|
||||
# test that additional information on e.g. Serial is printed
|
||||
assert "Serial" in result.stdout
|
||||
|
||||
def test_cli_text(self):
|
||||
def test_cli_text(self) -> None:
|
||||
"""Make sure text returns what we sent it"""
|
||||
test_text = "this is some text"
|
||||
result = self.env.run(
|
||||
@@ -108,7 +107,7 @@ class TestCLI:
|
||||
result.files_updated[DEVFILE_NAME].bytes == "\x1bt\x00" + test_text + "\n"
|
||||
)
|
||||
|
||||
def test_cli_text_invalid_args(self):
|
||||
def test_cli_text_invalid_args(self) -> None:
|
||||
"""Test a failure to send valid arguments"""
|
||||
result = self.env.run(
|
||||
*(self.default_args + ("text", "--invalid-param", "some data")),
|
||||
|
||||
Reference in New Issue
Block a user