Developers¶
Setup¶
First, you need to fork the GitHub repository.
Note : always work on a specific branch dedicated to your patch.
Then, you could need the
Embedded printer DP-EH600 Technical Manual
and take a look at the features advancement.Finally, be sure to add/update tests and documentation within your patch.
Testing¶
Adding/changing a method¶
Before all, you will add a test file for the new method. Then, there is a test file called test_methods.py
where all functions signatures are specified. Here is a little help to add a new one.
- Say we want to find the signature of the
size
function:
>>> from thermalprinter import ThermalPrinter
>>> from inspect import getargspec
>>> getargspec(ThermalPrinter.size)
ArgSpec(args=['self', 'value'], varargs=None, keywords=None, defaults=('S',))
- Copy the all line
ArgSpec(...)
. - Open the
test_methods.py
file and add a new test case, keep it sorted:
# Syntax of the function's name: test_signature_FUNCTION
def test_signature_size(methods):
methods.remove(extract_stack(None, 2)[1][2].replace('test_signature_', ''))
# Here, you paste the ArgSpec(...) line
sig = ArgSpec(args=['self', 'value'], varargs=None, keywords=None,
defaults=('S',))
# And here you use the function's name too
assert getargspec(ThermalPrinter.size) == sig
To summary, there are 3 modifications to apply, all functions in this file use the same syntax.
How to test?¶
Enable the developer mode:
python3 setup.py develop
Lauch the test suit:
python3 -m pytest
And you can test printing functions (if you added a styling method, you can add it to this function).