2019-08-22 12:40:24 +06:00
|
|
|
"""QMK Python Unit Tests
|
|
|
|
|
|
|
|
QMK script to run unit and integration tests against our python code.
|
|
|
|
"""
|
2021-05-20 04:24:46 +06:00
|
|
|
from subprocess import DEVNULL
|
2019-11-21 04:54:18 +06:00
|
|
|
|
2019-08-22 12:40:24 +06:00
|
|
|
from milc import cli
|
|
|
|
|
|
|
|
|
2021-12-09 12:42:11 +06:00
|
|
|
@cli.argument('-t', '--test', arg_only=True, action='append', default=[], help="Mapped to nose2 'testNames' positional argument - https://docs.nose2.io/en/latest/usage.html#specifying-tests-to-run")
|
2019-11-28 02:27:06 +06:00
|
|
|
@cli.subcommand('QMK Python Unit Tests', hidden=False if cli.config.user.developer else True)
|
2019-09-23 02:25:33 +06:00
|
|
|
def pytest(cli):
|
2019-11-21 04:54:18 +06:00
|
|
|
"""Run several linting/testing commands.
|
2019-08-22 12:40:24 +06:00
|
|
|
"""
|
2022-03-09 14:29:00 +06:00
|
|
|
nose2 = cli.run(['nose2', '-v', '-t', 'lib/python', *cli.args.test], capture_output=False, stdin=DEVNULL)
|
2021-08-30 05:50:22 +06:00
|
|
|
flake8 = cli.run(['flake8', 'lib/python'], capture_output=False, stdin=DEVNULL)
|
2021-05-11 00:18:44 +06:00
|
|
|
|
2019-11-21 04:54:18 +06:00
|
|
|
return flake8.returncode | nose2.returncode
|