TestCommand - evansde77/cirrus GitHub Wiki

Test Command

The test command executes a set (or subset of) the packages test code in the local development virtualenv

Test Suites

Suites are loosely defined as tests in a certain subdirectory, so that you can split up execution of unit tests, integ tests etc. The default behaviour is to run tests/unit as the location and this is the default suite.

To add a suite, create a section in the cirrus.conf labelled test-, for example: suite-integ. You can specify different test modes, locations of tests and options in each suite config and select the suite to run via the --suite command line option.

tox Mode

In tox mode, the tox command is used to run tests, and expects to find a tox.ini file describing which test variants to run. Note that tox will create its own local virtualenvs for each python environment (usually in .tox) so will need any extra arguments like private pypi servers added in the tox.ini.

nosetests Mode

This runs nosetests with the -w argument as the "where" option to invoke tests in the local virtualenv

pytest Mode

Runs pytest in the directory specified by where in the config, in the local virtualenv

Usage

git cirrus test --help
usage: test [-h] [--suite SUITE] [--mode {nosetests,tox}]
            [--test-options OPTIONS]

git cirrus test command

optional arguments:
  -h, --help            show this help message and exit
  --suite SUITE         test suite configuration to use as defined in the
                        test-<suite> section of cirrus.conf
  --mode {nosetests,tox, pytest}
                        Choose test runner framework
  --test-options OPTIONS
                        Optional args to pass to test runner

Configuration Options

Each suite of tests is defined in the cirrus.conf for the package, with suites named as test-SUITE in the config file.

Parameters:

  • where - Directory containing tests to be executed
  • mode - tox or nosetests
  • test_options - options to be passed to the test execution tool (eg -r -e py2.7 for tox, --with-coverage for nosetests etc)
⚠️ **GitHub.com Fallback** ⚠️