brandon-rhodes / assay

Attempt to write a Python testing framework I can actually stand
25 stars 7 forks source link

Add batch mode --verbose, --nocolor options and allow selecting/deselecting tests by regex patterns #10

Closed bnavigator closed 1 year ago

bnavigator commented 4 years ago

Hi,

This PR introduces 3 new features split in two and a half commits:

  1. Add the command argument -c, --nocolor to disable the tty color coding. Useful for CI logs, where the coloring control sequences look ugly, e.g. the openSUSE Build Service.
  2. Add the command argument -v, --verbose (available in batch mode only) to show which tests are running and passing instead of just a '.'
  3. Add the command family --pattern REGEX, -k REGEX and --deselect REGEX, + REGEX to filter tests by regular expressions.
$ python3 -m assay -h      
usage: assay [-h] [-b] [--pattern REGEX] [--deselect REGEX] [-v] [-c] name [name ...]

Fast testing framework

positional arguments:
  name                  directory, package, or module to test

optional arguments:
  -h, --help            show this help message and exit
  -b, --batch           run tests once, then exit with success or failure
  --pattern REGEX, -k REGEX
                        only run test functions matching the regular expression REGEX
  --deselect REGEX, +k REGEX
                        do not run test functions matching the regular expression REGEX
  -v, --verbose         be verbose in batch mode: print test names being tested
  -c, --nocolor         suppress colored printout