From 3e200a86b92b247fdf723e88268146e33f032936 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Wed, 10 Feb 2016 19:32:00 +0100 Subject: [PATCH] ADD very basic nosetest --- test/test_load_module.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/test_load_module.py diff --git a/test/test_load_module.py b/test/test_load_module.py new file mode 100644 index 0000000..455b074 --- /dev/null +++ b/test/test_load_module.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +"""very basic test cases that load the classes + +:author: `Patrick Kanzler `_ and others +:organization: Bashlinux and `python-escpos `_ +:copyright: Copyright (c) 2016 `python-escpos `_ +:license: GNU GPL v3 +""" + +from nose.tools import with_setup + +import escpos.printer as printer +import os + +def setup_testfile(): + """create a testfile as devfile""" + fhandle = open('testfile', 'a') + try: + os.utime('testfile', None) + finally: + fhandle.close() + +def teardown_testfile(): + """destroy testfile again""" + os.remove('testfile') + +@with_setup(setup_testfile, teardown_testfile) +def test_instantiation(): + """test the instantiation of a escpos-printer class and basic printing""" + instance = printer.File(devfile='testfile') + instance.text('This is a test\n')