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

View File

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