Introduction to Testing in Python
Alexander Levin
Data Scientist
Command-Line Interface (CLI) - a user interface that allows to interact with a computer program by entering text commands into a terminal.
The command for running the slides.py
from CLI:
pytest slides.py
Meaning: "Please, run the pytest
framework using the tests from the slides.py
module"
Output of a test:
Output of a test:
Output of a test:
Output of a test:
Output of a test:
The command for running all tests in tests_dir/
:
pytest tests_dir/
Meaning: "Please, run the pytest
framework using all found the tests from the tests_dir
folder".
The command for running tests from tests_ex.py
contains "squared":
pytest tests_ex.py -k "squared"
Meaning: "Please, run the pytest
framework using all tests from the tests_ex.py
script containing squared
".
Output:
pytest
script_name.py
directory_name/
-k "keyword_expression"
Introduction to Testing in Python