From patchwork Fri Jul 19 06:29:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Mikanovich X-Patchwork-Id: 3704 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 19 Jul 2024 08:29:59 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-lj1-f189.google.com (mail-lj1-f189.google.com [209.85.208.189]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 46J6Txgg032267 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 19 Jul 2024 08:29:59 +0200 Received: by mail-lj1-f189.google.com with SMTP id 38308e7fff4ca-2ee864483c2sf16781561fa.2 for ; Thu, 18 Jul 2024 23:29:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1721370594; cv=pass; d=google.com; s=arc-20160816; b=wHwprMdcFcCzpcq1EfYRy7LMyX/DQA0HvyayUzL4rGcSWlU3jgNYdU3XbXxGVxnQgk W4VuvS07jmqW775z8Enqk0V41Ws19vMX1+vHxvN9X15YY4Z99N/MHjtV75WUDjCIP6YC QjVfkGdfLe8OUiwMzrvpjJjE+dk2a1HezNXayEdy+Nfm5LPk26fFhmzFUi/tHudM9eXL pjHX2zjyAjvhgjLRwlO2Tdag8xrJpAbcpwdZ2+eT1gUDQQ6WKhzPKm1C5McWIM4MosIl JuKnnbkaLncclxiZ7w23Jbe4o8C4+I+v/yXXhYX5gyxxRzZFhQQMHBmfZNcIw6ojpob6 +kdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=FkCRclZDdmTQyhqLgNIJ2yEpHSckqHbHu7zfwWbgsqE=; fh=tyXh7rrbWnJSarAu0VfyCHdMzpXdPR4YC6fWS00igVk=; b=moeNGd7iX05ddLi61D0GQZAa6l2GxLr2PyjPsR2ef/dUmzN3Ck+yyP6ufYasBKhT15 DrSJhfIAJ5cnjDruX6vi9KVKaT7p9YBQudSj2VpCrklHHRtfZ2EPIOLP2xOlzEV1kSj+ 06LGUgw1EUUUqZTKAPQyc3PlD8FZOnlyuWsW6qKn6T11i/4aIJIwhztRhoywnddMCzTd zlXoxfB3bDLyirFZXW5+T4l/LmkfDBjUaQthhIw3SFYu9H/jU5AloVxs6AlO4lVAvrC1 tCHezqtyleScANUwrzwq+VgeS+Cn2AUk5jMqXz9qg4C9R3SBGjoOfFyuk+6BA9PIXTDm IsMw==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1721370594; x=1721975394; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=FkCRclZDdmTQyhqLgNIJ2yEpHSckqHbHu7zfwWbgsqE=; b=Zgip6nEaaxCOVmkivZLJ1n351YGPQFRrDtRyQGUjsXMJs/x3aVLcHWwC/T4AKzPD9z ropIcpbhDuqGv2vb54IwSZOZZ8aQfvLcQv4UCbbneM5Yf/qkhAJ69PVCuEzxmKQ+A8ch ANawdz/lzJ4J7ZOaDp2b3x9uZCSetayWy4Wc2WwTyrwZWuz8aSoi4A/0EJh+gehyO/ml 8z2d48Uh0r1/I85o7R5b+Cocfet62xU8jJ86naPud22edF6DmPXO5b0r6oDHjKXa4XB2 ep7U5sEVurzacTf+3O7ifvJkP+VihvtePbxBQxZdfKSTTTe0IbiA35Ft3KUjF3lSIVuC riMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721370594; x=1721975394; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=FkCRclZDdmTQyhqLgNIJ2yEpHSckqHbHu7zfwWbgsqE=; b=FmyxppInKnzZFomblN1i5nG8iBrS3/fsPTLuc1Wa+0EvjAs5qvYCanL3G2jBXpMlsk 5wB3td69iTk+zmBnVFDvc672ga638lDWvcxPGpZgey0DUkADUdyUAWagi19Gpt++Bamb HTDQJwZwN5sAvrcFjcxChFfnsLPVX7izGSyvSkCVrW/6HjOeZihO0hf034SChRvBdVvI GEgA8ocXB+Eiym0FnU2f6raml14ul4uMktzzvrbecKokNJq1gudxvYrCNb6oz08W1nNC W37zg5t49F7F/HND1tqGAnIzj/j9i1EKhRDC7Bd+UKf52bXdaSEHzm/vh+b10y9UR3F2 D9uA== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXwrpW0d3NZuooSRdbobTRivTeKzOI+ySvVImg8T1Me1RM0Gk0iQYc8DxubeUq6Js0CuXpEMstz3X2BLJKa0M/2dIPzivo= X-Gm-Message-State: AOJu0YxWuiK7JjA078NldPeZTc8x7fFbG1+2x6NsUw98y0vTvPM4TW4Z tc6NeA9jtO4SR7OvsIiG9BitctgjIHHwzOogY5ntALyV74TcY3M8 X-Google-Smtp-Source: AGHT+IGEsAaVlqmO4efPJ8rxG0DblmfSWru5jL+z2fVVXtL0By1n6OoQLptlih1yt5WytwWyFif4kg== X-Received: by 2002:a2e:91cb:0:b0:2ec:5964:9c0d with SMTP id 38308e7fff4ca-2ef0599a549mr32411861fa.0.1721370593001; Thu, 18 Jul 2024 23:29:53 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:a98a:0:b0:2ee:8cc1:3689 with SMTP id 38308e7fff4ca-2ef04dd34acls6454181fa.2.-pod-prod-03-eu; Thu, 18 Jul 2024 23:29:51 -0700 (PDT) X-Received: by 2002:a05:6512:3c84:b0:52c:9906:fa33 with SMTP id 2adb3069b0e04-52ee5428bc1mr4870911e87.43.1721370591040; Thu, 18 Jul 2024 23:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721370591; cv=none; d=google.com; s=arc-20160816; b=nh7Sro8rFk3V21qgK5jQRBQHkUA/NjUF6mw6znIq45A/bG1KGi9c0zyyiN8TAmaC5u +pF3K1NftVn+ayF6KqOrB6NnIpkl43uT2pcalXzKVP6lVJihrWxj3qUjazawlgxgDAg3 X1Nag8uhTeOOn7fiLq6pCUG1XlXVfLVcZ4jS2vt3UdUbtbaEmOsuNIBtW1W9zPbXiiwm BBoLBaok+ZZsJE9SW+YSbC6P04s7u21y/WO5h0BTll1tF5+15+hB5RVujwyv6ZK3n79k 6V4sB7wu+TIGLhgRpB95FLL1kMLFqGiNHzE7/qOrNKq3wPVfTSTFlHNTgDb1zYNYN9+d xMJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Irvjao5qWmdQEnvNn2XyJjbgWYNDC1Aj8selNgoc9j4=; fh=/h9QQkzJ8EboVkWg45aWwpaUro6WMavIVd2OhN45RtE=; b=jeeZqNfwi5cvDsm38aLz7MlcX8/W+0H+WyyjaZFUB+MF+oYTIIAE+M6lZyYec4uNuG mBAvpmfanK+7oHQz1n0WYHgmeqI1pz6NonVLOusJMUc5fevppT+amn1DWKVAalXFvtql VTIzDmziT92u5x8VXy8wpgYby8uLJGqeI/UqqkzXyypTVzrRcVMaua2ll0C7rvfqaHWY SrroN6ry4aL07lcDhS6Wi/2ryr+sOZ07Ps2MkVSRi/f9OcyluiGyWE2HELPX+csqe/Jx /AqVDJJ0SYQt0ZrTsF3lx3rcagEQi7BY2fVHM7PFZE/35IdJhpffMxFiIQmlAQkRgwFJ Yj9Q==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-52ef55182bdsi16353e87.7.2024.07.18.23.29.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jul 2024 23:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Received: from user-B660.promwad.corp ([159.148.83.114]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 46J6Tm5p032243 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Jul 2024 08:29:49 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Anton Mikanovich Subject: [PATCH v2 1/2] testsuite: Provide code style documentation Date: Fri, 19 Jul 2024 09:29:39 +0300 Message-Id: <20240719062940.2601132-2-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240719062940.2601132-1-amikan@ilbers.de> References: <20240719062940.2601132-1-amikan@ilbers.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-Original-Sender: amikan@ilbers.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= Add some recomendations for testcase creators. Signed-off-by: Anton Mikanovich --- testsuite/README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/testsuite/README.md b/testsuite/README.md index cfcfb1bf..3b2be5af 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -137,6 +137,56 @@ 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 preferred 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 that don't fit in the 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. + +## String formatting + +Use format strings (f"The value is {x}") instead of printf-style formatting +("The value is %d" % x) or string concatenations ("The value is " + str(x)). + +## Function definition spacing + +Any function and class definition should be 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.