From efdb8b33e7e3f98e7e0708019d7cd6df32f5b461 Mon Sep 17 00:00:00 2001 From: Norwid Behrnd Date: Sun, 3 Nov 2024 19:16:54 +0100 Subject: [PATCH] docs: update documentation, first set of tests Documentation about the first set of tests (default append of a string to the file's file name) was updated. Signed-off-by: Norwid Behrnd --- test_appendfilename.py | 37 ++++++++++++++++++++++++------------- test_generator.org | 36 +++++++++++++++++++++++------------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/test_appendfilename.py b/test_appendfilename.py index a196d24..59baa6b 100644 --- a/test_appendfilename.py +++ b/test_appendfilename.py @@ -8,21 +8,31 @@ # """Test pad for functions by appendfilename with pytest. -Written for Python 3.9.9 and pytest 6.2.4 for Python 3 as provided by -Linux Debian 12/bookworm, branch testing, this is a programmatic check +Initially written for Python 3.9.9 and pytest 6.2.4 and recently update +for Python 3.12.6/pytest 8.3.3, this script provides a programmatic check of functions offered by appendfilename. Deposit this script in the root of -the folder fetched and unzipped from PyPi or GitHub. If your system -includes both legacy Python 2 and Python 3, pytest for Python 3 likely -is named pytest-3; otherwise only pytest. Thus, adjust your input on -the CLI accordingly when running either one of +the folder fetched and unzipped from PyPi or GitHub. Create a virtual +environment for Python, e.g. by -pytest -v test_appendfilename.py -pytest-3 -v test_appendfilename.py +```shell +python -m venv sup +``` -These instruction initiate a verbose testing (flag -v) reported back to the -CLI.re will be a verbose report to the CLI The script either stops when one of -the tests fail (flag -x), or after completion of the test sequence. In both -cases, the progress of the ongoing tests is reported to the CLI (flag -v).""" +In the activated virtual environment, ensure the dependencies are met - +either by `pip install pyreadline3 pytest`, or `pip install -r requirements.txt` +- and launch the tests by + +```shell +python -m pytest +``` + +As a reminder, the following optional pytest flags may be useful to obtain +a report tailored to your needs: + +- `-x` exits right after the first failing test (reported by `E` instead of `.`) +- `-v` provide a more verbose output +- `-s` equally report the test criterion, e.g. the queried file name +""" import re import os @@ -37,7 +47,8 @@ import pytest PROGRAM = os.path.join("appendfilename", "__init__.py") # Cross-platform path # The following section tests the applications default pattern where a string -# is added to the file name, just prior to the file's file extension. +# is added to the file name, just prior to the file's file extension. The +# permutation of the three arguments and their levels defines 120 tests. arg1_values = [ "test.txt", "2021-12-31_test.txt", "2021-12-31T18.48.22_test.txt" diff --git a/test_generator.org b/test_generator.org index 53c12ff..2d38a5d 100755 --- a/test_generator.org +++ b/test_generator.org @@ -158,7 +158,7 @@ pytest-3 test_appendfilename.py -m "default and prepend" -v #+begin_src python :tangle no [pytest] -markers = +Markers = default: check the default insertion position of appendfile prepend: check the prepend insertion position of appendfile smart: check the smart-prepend insertion position of appendfile @@ -180,21 +180,31 @@ markers = # """Test pad for functions by appendfilename with pytest. -Written for Python 3.9.9 and pytest 6.2.4 for Python 3 as provided by -Linux Debian 12/bookworm, branch testing, this is a programmatic check +Initially written for Python 3.9.9 and pytest 6.2.4 and recently update +for Python 3.12.6/pytest 8.3.3, this script provides a programmatic check of functions offered by appendfilename. Deposit this script in the root of -the folder fetched and unzipped from PyPi or GitHub. If your system -includes both legacy Python 2 and Python 3, pytest for Python 3 likely -is named pytest-3; otherwise only pytest. Thus, adjust your input on -the CLI accordingly when running either one of +the folder fetched and unzipped from PyPi or GitHub. Create a virtual +environment for Python, e.g. by -pytest -v test_appendfilename.py -pytest-3 -v test_appendfilename.py +```shell +python -m venv sup +``` -These instruction initiate a verbose testing (flag -v) reported back to the -CLI.re will be a verbose report to the CLI The script either stops when one of -the tests fail (flag -x), or after completion of the test sequence. In both -cases, the progress of the ongoing tests is reported to the CLI (flag -v).""" +In the activated virtual environment, ensure the dependencies are met - +either by `pip install pyreadline3 pytest`, or `pip install -r requirements.txt` +- and launch the tests by + +```shell +python -m pytest +``` + +As a reminder, the following optional pytest flags may be useful to obtain +a report tailored to your needs: + +- `-x` exits right after the first failing test (reported by `E` instead of `.`) +- `-v` provide a more verbose output +- `-s` equally report the test criterion, e.g. the queried file name +""" import re import os