mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
add version-strings into the module
The version string is in the module as __version__ available. In the doc the version will be automatically parsed. The version comes from the installed module if on read the docs or directly from setuptools_scm if you are working locally. The CLI will issue the version string if you call it with the option 'version'. The CLI does not accept commands like '--version', since this would not be conform with the rest of the interface (and argparse). The configuration for loading the version-string is adapted from pimutils/vdirsyncer. It autogenerates a version string setuptools_scm at install-time and then adds it to the __version__ member in __init__.py I adapted the GitHub-template with a fitting comment and bumped the changelog. closes #141
This commit is contained in:
@@ -11,6 +11,7 @@ import os
|
||||
import sys
|
||||
from scripttest import TestFileEnvironment
|
||||
from nose.tools import assert_equals
|
||||
import escpos
|
||||
|
||||
TEST_DIR = os.path.abspath('test/test-cli-output')
|
||||
|
||||
@@ -29,7 +30,7 @@ printer:
|
||||
)
|
||||
|
||||
|
||||
class TestCLI:
|
||||
class TestCLI():
|
||||
""" Contains setups, teardowns, and tests for CLI
|
||||
"""
|
||||
|
||||
@@ -60,8 +61,7 @@ class TestCLI:
|
||||
)
|
||||
|
||||
self.default_args = (
|
||||
sys.executable,
|
||||
'-mescpos.cli',
|
||||
'python-escpos',
|
||||
'-c',
|
||||
CONFIGFILE,
|
||||
)
|
||||
@@ -79,10 +79,16 @@ class TestCLI:
|
||||
|
||||
def test_cli_help(self):
|
||||
""" Test getting help from cli """
|
||||
result = self.env.run(sys.executable, '-mescpos.cli', '-h')
|
||||
result = self.env.run('python-escpos', '-h')
|
||||
assert not result.stderr
|
||||
assert 'usage' in result.stdout
|
||||
|
||||
def test_cli_version(self):
|
||||
""" Test the version string """
|
||||
result = self.env.run('python-escpos', 'version')
|
||||
assert not result.stderr
|
||||
assert_equals(escpos.__version__, result.stdout.strip())
|
||||
|
||||
def test_cli_text(self):
|
||||
""" Make sure text returns what we sent it """
|
||||
test_text = 'this is some text'
|
||||
|
Reference in New Issue
Block a user