From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 1/2] testsuite: Provide code style documentation
Date: Fri, 12 Jul 2024 15:13:23 +0300 [thread overview]
Message-ID: <20240712121324.2200037-2-amikan@ilbers.de> (raw)
In-Reply-To: <20240712121324.2200037-1-amikan@ilbers.de>
Add some recomendations for testcase creators.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/testsuite/README.md b/testsuite/README.md
index cfcfb1bf..7cbacf99 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -137,6 +137,51 @@ avocado so that isar testsuite files could be found:
export PYTHONPATH=${PYTHONPATH}:${TESTSUITEDIR}
```
+# Code style for testcases
+
+Recommended Python code style for the testcases is based on
+[PEP8 Style Guide for Python Code](https://peps.python.org/pep-0008) with
+several additions described below.
+
+## Using quotes
+
+Despite [PEP8](https://peps.python.org/pep-0008) doesn't have any string quote
+usage recommendations, Isar preffered style is the following:
+
+ - Single quotes for data and small symbol-like strings.
+ - Double quotes for human-readable strings and string interpolation.
+
+## Line wrapping
+
+Argument lists don't fit in 79 characters line limit should be placed on the
+new line, keeping them on the same line if possible. Otherwise every single
+argument should be placed in separate line.
+
+## Function definition spacing
+
+Any function and class definition should done in the following way:
+
+ - One line before and after inner functions.
+ - Two lines before and after module-level functions and classes.
+
+## Tools for checking code style
+
+To check the compliance with PEP8 standards:
+
+```
+$ flake8 sample.py
+```
+
+To format the code to recommended code style:
+
+```
+$ black -S -l 79 sample.py
+```
+
+Black use it's own [code style](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html)
+based on [PEP8](https://peps.python.org/pep-0008), so some options should be
+used to set non-default style checking behaviour.
+
# Example of the downstream testcase
See `meta-isar/test` for an example of the testcase for kas-based downstream.
--
2.34.1
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20240712121324.2200037-2-amikan%40ilbers.de.
next prev parent reply other threads:[~2024-07-12 12:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 12:13 [PATCH 0/2] Python code style for the testsuite Anton Mikanovich
2024-07-12 12:13 ` Anton Mikanovich [this message]
2024-07-15 6:22 ` [PATCH 1/2] testsuite: Provide code style documentation 'Schmidt, Adriaan' via isar-users
2024-07-12 12:13 ` [PATCH 2/2] testsuite: Fix code style Anton Mikanovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240712121324.2200037-2-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox