aboutsummaryrefslogtreecommitdiff
path: root/docs/coding_conventions_python.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/coding_conventions_python.md')
-rw-r--r--docs/coding_conventions_python.md18
1 files changed, 15 insertions, 3 deletions
diff --git a/docs/coding_conventions_python.md b/docs/coding_conventions_python.md
index 694aa38cf..1aefc044e 100644
--- a/docs/coding_conventions_python.md
+++ b/docs/coding_conventions_python.md
@@ -8,7 +8,7 @@ Most of our style follows PEP8 with some local modifications to make things less
8 * Think of them as a story describing the feature 8 * Think of them as a story describing the feature
9 * Use them liberally to explain why particular decisions were made. 9 * Use them liberally to explain why particular decisions were made.
10 * Do not write obvious comments 10 * Do not write obvious comments
11 * If you not sure if a comment is obvious, go ahead and include it. 11 * If you're not sure if a comment is obvious, go ahead and include it.
12* We require useful docstrings for all functions. 12* We require useful docstrings for all functions.
13* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns. 13* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns.
14* Some of our practices conflict with the wider python community to make our codebase more approachable to non-pythonistas. 14* Some of our practices conflict with the wider python community to make our codebase more approachable to non-pythonistas.
@@ -309,6 +309,18 @@ FIXME(username): Revisit this code when the frob feature is done.
309 309
310...where username is your GitHub username. 310...where username is your GitHub username.
311 311
312# Unit Tests 312# Testing
313 313
314These are good. We should have some one day. 314We use a combination of Integration and Unit testing to ensure that the our code is as bug-free as possible. All the tests can be found in `lib/python/qmk/tests/`. You can run all the tests with `qmk pytest`.
315
316At the time of this writing our tests are not very comprehensive. Looking at the current tests and writing new test cases for untested situations is a great way to both familiarize yourself with the codebase and contribute to QMK.
317
318## Integration Tests
319
320Integration tests can be found in `lib/python/qmk/tests/test_cli_commands.py`. This is where CLI commands are actually run and their overall behavior is verified. We use [`subprocess`](https://docs.python.org/3.5/library/subprocess.html#module-subprocess) to launch each CLI command and a combination of checking output and returncode to determine if the right thing happened.
321
322## Unit Tests
323
324The other `test_*.py` files in `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.
325
326At the time of this writing we do not do any mocking for our tests. If you would like to help us change this please [open an issue](https://github.com/qmk/qmk_firmware/issues/new?assignees=&labels=cli%2C+python&template=other_issues.md&title=) or [join #cli on Discord](https://discord.gg/heQPAgy) and start a conversation there.