clarify how to invoke pytest

Maintainers/developers of pytest have little influence only if
pytest (for Python 3) in Linux is invoked by pytest, or pytest-3.
Commit accounts for their clarification provided.
This commit is contained in:
Norwid Behrnd 2022-01-09 10:21:26 +01:00
parent 1906e48038
commit fa392db03d
2 changed files with 30 additions and 29 deletions

View file

@ -1,11 +1,11 @@
# GNU Make file for the automation of pytest for date2name. # GNU Make file for the automation of pytest for date2name.
# #
# While the test script is written for Python 3.9.2, you might need to # While the test script is written for Python 3.9.2, it depends on
# adjust the following instruction once in case your OS includes pytest # your installation of pytest (and in case of Linux, the authors of
# for legacy Python 2 side by side to Python 3, or only hosts pytest # your distribution) if pytest for Python 3 is invoked either by
# for Python 3. The tests in script test_date2name.py are set up to # pytest, or pytest-3. In some distributions, pytest actually may
# work with pytest for Python 3; dependent on your installation, which # invoke pyest for legacy Python 2; the tests in test_date2name.py
# may be named pytest-3, or (again) pytest. # however are incompatible to this.
# #
# Put this file like test_date2name.py in the root folder of date2name # Put this file like test_date2name.py in the root folder of date2name
# fetched from PyPi or GitHub. Then run # fetched from PyPi or GitHub. Then run
@ -17,5 +17,5 @@
# right after the first test failing, use the -x flag to the # right after the first test failing, use the -x flag to the
# instructions on the CLI in addition to the verbosity flag to (-v). # instructions on the CLI in addition to the verbosity flag to (-v).
# pytest -v test_date2name.py # only pytest for Python 3 is present # pytest -v test_date2name.py # the pattern by pytest's manual
pytest-3 -v test_date2name.py # pytest if Python 2 and Python 3 coexist pytest-3 -v test_date2name.py # the alternative pattern (e.g., Debian 12)

View file

@ -1,6 +1,6 @@
#+NAME: test_generator.org #+NAME: test_generator.org
#+AUTHOR: nbehrnd@yahoo.com #+AUTHOR: nbehrnd@yahoo.com
#+DATE: 2022-01-03 (YYYY-MM-DD) #+DATE: 2022-01-09 (YYYY-MM-DD)
# License: GPL3, 2021. # License: GPL3, 2021.
#+PROPERTY: header-args :tangle yes #+PROPERTY: header-args :tangle yes
@ -18,23 +18,24 @@
* Deployment * Deployment
On a computer with Python 3 only, the recommended call on the CLI to run the The programmatic tests are set up for pytest for Python 3. It
tests is either one of the following instructions (you might need to add the however depends on your installation (and in case of Linux, the
executable bit): authors of your Linux distribution ([[https://github.com/pytest-dev/pytest/discussions/9481][reference]])) if this utility may
be started by =pytest= (e.g., the pattern in pytest's manual), or by
=pytest-3= by either one of the pattern below:
#+begin_src bash :tangle no #+begin_src bash :tangle no
python pytest -v test_date2name.py pytest -v test_date2name.py
./Makefile pytest-3 -v test_date2name.py
#+end_src #+end_src
In case the computer you use equally includes an installation of legacy As of writing, the later pattern is the to be used e.g., in Linux
Python 2 side-by-side to Python 3, you must explicitly call for the later Debian 12/bookworm (branch testing) to discern pytest (for
branch of the two. Depending on your OS, this requires an adjustment of the contemporary Python 3) from pytest (for legacy Python 2).
command issued. In Linux Debian 12/bookworm, branch testing, for example,
#+begin_src bash :tangle no The =Makefile= this =org= file provides for convenience running
python3 pytest-3 -v test_date2name.py these tests assumes the later syntax pattern. (It might be
#+end_src necessary to provide the executable bit to activate the Makefile.)
* Setup of Emacs * Setup of Emacs
@ -102,12 +103,12 @@
#+BEGIN_SRC makefile :tangle Makefile #+BEGIN_SRC makefile :tangle Makefile
# GNU Make file for the automation of pytest for date2name. # GNU Make file for the automation of pytest for date2name.
# #
# While the test script is written for Python 3.9.2, you might need to # While the test script is written for Python 3.9.2, it depends on
# adjust the following instruction once in case your OS includes pytest # your installation of pytest (and in case of Linux, the authors of
# for legacy Python 2 side by side to Python 3, or only hosts pytest # your distribution) if pytest for Python 3 is invoked either by
# for Python 3. The tests in script test_date2name.py are set up to # pytest, or pytest-3. In some distributions, pytest actually may
# work with pytest for Python 3; dependent on your installation, which # invoke pyest for legacy Python 2; the tests in test_date2name.py
# may be named pytest-3, or (again) pytest. # however are incompatible to this.
# #
# Put this file like test_date2name.py in the root folder of date2name # Put this file like test_date2name.py in the root folder of date2name
# fetched from PyPi or GitHub. Then run # fetched from PyPi or GitHub. Then run
@ -119,8 +120,8 @@
# right after the first test failing, use the -x flag to the # right after the first test failing, use the -x flag to the
# instructions on the CLI in addition to the verbosity flag to (-v). # instructions on the CLI in addition to the verbosity flag to (-v).
# pytest -v test_date2name.py # only pytest for Python 3 is present # pytest -v test_date2name.py # the pattern by pytest's manual
pytest-3 -v test_date2name.py # pytest if Python 2 and Python 3 coexist pytest-3 -v test_date2name.py # the alternative pattern (e.g., Debian 12)
#+end_src #+end_src
** Building a pytest.ini ** Building a pytest.ini