def test_main_first_arg_version(capsys): """ If there is a single argument of "--version", it prints the version and exits. """ with pytest.raises(SystemExit): uflash.main(argv=['--version']) stdout, stderr = capsys.readouterr() expected = uflash.get_version() # On python 2 --version prints to stderr. On python 3 to stdout. # https://bugs.python.org/issue18920 assert (expected in stdout) or (expected in stderr)
# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. project = "uFlash" copyright = "2015, Nicholas H.Tollervey" author = "Nicholas H.Tollervey" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = uflash.get_version() # The full version, including alpha/beta/rc tags. release = uflash.get_version() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y'
def test_get_version(): """ Ensure a call to get_version returns the expected string. """ result = uflash.get_version() assert result == '.'.join([str(i) for i in uflash._VERSION])
#!/usr/bin/env python3 from setuptools import setup from uflash import get_version with open('README.rst') as f: readme = f.read() with open('CHANGES.rst') as f: changes = f.read() setup( name='uflash', version=get_version(), description='A module and utility to flash Python onto the BBC micro:bit.', long_description=readme + '\n\n' + changes, author='Nicholas H.Tollervey', author_email='*****@*****.**', url='https://github.com/ntoll/uflash', py_modules=[ 'uflash', ], license='MIT', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Education', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3',
import sys import uflash if len(sys.argv) > 1: filename = sys.argv[1] else: print "Missing filename on command line." sys.exit(1) print "File: " + filename print "Looking for micro:bit..." microbitPath = uflash.find_microbit() if microbitPath == None: print "Cannot find micro:bit. Check that it is plugged in via USB." sys.exit(1) print "micro:bit found @ " + microbitPath print "uflash version " + uflash.get_version() uflash.flash(filename, microbitPath)
#!/usr/bin/env python3 from setuptools import setup from uflash import get_version with open('README.rst') as f: readme = f.read() with open('CHANGES.rst') as f: changes = f.read() setup( name='uflash', version=get_version(), description='A module and utility to flash Python onto the BBC micro:bit.', long_description=readme + '\n\n' + changes, author='Nicholas H.Tollervey', author_email='*****@*****.**', url='https://github.com/ntoll/uflash', py_modules=['uflash', ], license='MIT', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: Education', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3',
#source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'uFlash' copyright = '2015, Nicholas H.Tollervey' author = 'Nicholas H.Tollervey' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = uflash.get_version() # The full version, including alpha/beta/rc tags. release = uflash.get_version() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y'