4. Command Line Interface

The package setuptestx provides the extension command testx for the standard command line interface of setup.py.

With the additional common local options fo setup.py:

–sdk

Extends the dependencies for development utilities.

–no-install-requires

Deactivates pre-requisites.

–offline

Deactivates PyPi access.

–help-setuplib

Displays help for setuplib.

4.2. GLOBAL OPTIONS

4.2.1. –sdk

Supports a separate dependency list for the build and packaging environment. The following informal convention has to be implemented within the file setup.py.

__sdk = False
"""Set by the option "--sdk". Controls the installation environment."""

if '--sdk' in sys.argv:
    _sdk = True
    sys.argv.remove('--sdk')


_packages_sdk = find_packages(include=['setuplib'] )  # your development packages
"""Python packages to be installed."""


if __sdk: # pragma: no cover
    try:
        import sphinx_rtd_theme  # @UnusedImport
    except:
        sys.stderr.write("WARNING: Cannot import package 'sphinx_rtd_theme', cannot create local 'ReadTheDocs' style.")

    _install_requires.extend(
        [
            'sphinx >= 1.4',
            'epydoc >= 3.0',
        ]
    )

    _packages = _packages_sdk

For an example refer to setup.py of setuplib.

4.2.2. –no-install-requires

Suppresses installation dependency checks, requires appropriate PYTHONPATH. The following informal convention has to be implemented within the file setup.py.

__no_install_requires = False

if '--no-install-requires' in sys.argv:
    __no_install_requires = True
    sys.argv.remove('--no-install-requires')


if __no_install_requires:
    print("#")
    print("# Changed to offline mode, ignore install dependencies completely.")
    print("# Requires appropriate PYTHONPATH.")
    print("# Ignored dependencies are:")
    print("#")
    for ir in _install_requires:
        print("#   "+str(ir))
    print("#")
    _install_requires=[]

For an example refer to setup.py of setuplib.

4.2.3. –offline

Sets online dependencies to offline, or ignores online dependencies. The following informal convention has to be implemented within the file setup.py.

__offline = False

if '--offline' in sys.argv:
    __offline = True
    __no_install_requires = True
    sys.argv.remove('--offline')

For an example refer to setup.py of setuplib.

4.2.4. –help-setuptestx

Special help for setuptestx.

For an example refer to setup.py.

4.3. COMMANDS

testx

Call regression tests, and poll information on execution environment.

4.3.1. testx

Calls unittest in the subdirectory tests. Supports multiple Python implementations, including all major implementations.

4.3.1.1. –abs

Change all paths where possible to absolute.

setup.py testx --abs

4.3.1.2. –call=

Call of tests, default ‘CallCase.py’.

setup.py testx --call=<call-program>  # see unittest '-p'
setup.py testx -p <call-program>      # see unittest '-p'

4.3.1.3. –coff

JYTHON: set cache off

setup.py testx --coff

sets

jython -Dpython.cachedir.skip=true

4.3.1.4. –implementation=

The Python implementation, default is ‘python’ - CPython. Changes to e.g. ‘jython’ needs eventually additional options. Tested values are: python, jython, ipython, ipy, pypy.

Call of tests, default ‘CallCase.py’.

setup.py testx --call=<python-implementation>
setup.py testx -i     <python-implementation>

4.3.1.5. –jyjar=

JYTHON: switch to call of ‘java -jar <use-jython-jar>’, requires absolute path.

setup.py testx --jyjar=<use-jython-jar>
setup.py testx -j <use-jython-jar>

# default: jython, not 'jython.jar'

The default executable names for Jython are

java -jar jython.jar

4.3.1.6. –jyjvm=

JYTHON: Java JVM options for Jyhon:

setup.py testx --jyjvm=<jvm-options>
setup.py testx -J<jvm-options>

for example:

jython -J-Xmx512m

4.3.1.7. –jyprop=

JYTHON: properties ‘<prop>=<value>’,

setup.py testx --jyprop='<prop>=<value>'
setup.py testx -D '<prop>=<value>'

for example:

jython -Dpython.path=/my/path

4.3.1.8. –noexec

Print only, do not execute.

setup.py testx --noexec

4.3.1.9. –start=

Start package, e.g. ‘tests’ or ‘tests.setuplib’.

setup.py testx --start=<start-package>  # see unittest '-s'
setup.py testx -s <start-package>       # see unittest '-s'

4.3.1.10. –testlib=

The test library, default ‘unittest discover’.

setup.py testx --testlb=<module-of-test-framework>  # see unittest '-m'
setup.py testx -m       <module-of-test-framework>  # see unittest '-m'

4.3.1.11. –verbose

Verbose flag.

setup.py testx --verbose

Passes the verbose flag, e.g. ‘jython -v’ or ‘python -v’.

4.4. DESCRIPTION

The call interface ‘settestx’ provides command line extensions for the regression tests.

4.5. EXAMPLES

  • CPython - see Howto CPython:

    python setup.py testx --print-vinfo -i python
    python setup.py testx --print-vinfo -i python3
    python setup.py testx --print-vinfo -i python3.5
    python setup.py testx --print-vinfo -i python2
    
  • IPython - see Howto IPython:

    python setup.py testx --print-vinfo -i ipython
    python setup.py testx --print-vinfo -i ipython2
    python setup.py testx --print-vinfo -i ipython3
    
  • IronPython - see Howto IronPython:

  • Jython:

    python setup.py testx --print-vinfo -i jython
    
  • PyPy - see Howto PyPy:

    python setup.py testx --print-vinfo -i pypy
    python setup.py testx --print-vinfo -i pypy2
    python setup.py testx --print-vinfo -i pypy3
    

The setuptestx supports hereby basic subprocess calls by os.system(), thus supports the modification of the called environment by shell inheritance. For example in case of the bash:

PATH=/opt/pypy/pypy3.5-5.10.1/bin/:$PATH python setup.py testx --print-vinfo -i pypy

For more advanced options refer to a never release of the epyunit [EPYUNIT].