improve packaging and test environment

This commit is contained in:
Patrick Kanzler 2016-02-11 18:37:13 +01:00
parent 3e200a86b9
commit d672ca1268
No known key found for this signature in database
GPG Key ID: F07F07153306FCEF
2 changed files with 13 additions and 11 deletions

View File

@ -38,10 +38,10 @@ class Tox(TestCommand):
sys.exit(errno)
setup(
name='escpos',
version='1.0.9',
url='https://github.com/manpaz/python-escpos',
download_url='https://github.com/manpaz/python-escpos.git',
name='python-escpos',
version='1.0.9-dev',
url='https://github.com/python-escpos/python-escpos',
download_url='https://github.com/python-escpos/python-escpos/archive/master.zip',
description='Python library to manipulate ESC/POS Printers',
license='GNU GPL v3',
long_description=read('README'),
@ -71,6 +71,6 @@ setup(
'qrcode>=4.0',
'pyserial',
],
tests_require=['tox'],
tests_require=['tox', 'nose'],
cmdclass={'test': Tox},
)

View File

@ -1,8 +1,8 @@
#!/usr/bin/python
"""very basic test cases that load the classes
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_ and others
:organization: Bashlinux and `python-escpos <https://github.com/python-escpos>`_
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2016 `python-escpos <https://github.com/python-escpos>`_
:license: GNU GPL v3
"""
@ -12,20 +12,22 @@ from nose.tools import with_setup
import escpos.printer as printer
import os
devfile = 'testfile'
def setup_testfile():
"""create a testfile as devfile"""
fhandle = open('testfile', 'a')
fhandle = open(devfile, 'a')
try:
os.utime('testfile', None)
os.utime(devfile, None)
finally:
fhandle.close()
def teardown_testfile():
"""destroy testfile again"""
os.remove('testfile')
os.remove(devfile)
@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 = printer.File(devfile=devfile)
instance.text('This is a test\n')