from ... import .... Understandability and maintainability is our ultimate goal.
from foo import *. Supply a list of objects you want to import instead, or import the whole module.
if foo: bar) we do not combine 2 statements onto a single line.
eas an exception identifier in try/except statements.
-) in any package/module name
__double_leading_and_trailing_underscore__names (reserved by Python)
cli.echo()and the various
cli.log.info()) for more details.
lib/python/qmk/tests/. You can run all the tests with
lib/python/qmk/tests/test_cli_commands.py. This is where CLI commands are actually run and their overall behavior is verified. We use
subprocessto launch each CLI command and a combination of checking output and returncode to determine if the right thing happened.
lib/python/qmk/tests/contain unit tests. You can write tests for individual functions inside
lib/python/qmk/here. Generally these files are named after the module, with dots replaced by underscores.