Introducere în testarea în Python
Alexander Levin
Data Scientist
Interfața în linie de comandă (CLI) – o interfață care permite interacțiunea cu un program prin introducerea de comenzi text într-un terminal.
Comanda pentru a rula slides.py din CLI:
pytest slides.py
Semnificație: „Rulează framework-ul pytest folosind testele din modulul slides.py"
Rezultatul unui test:

Rezultatul unui test:

Rezultatul unui test:

Rezultatul unui test:

Rezultatul unui test:



Comanda pentru a rula toate testele din tests_dir/:
pytest tests_dir/
Semnificație: „Rulează framework-ul pytest folosind toate testele găsite în folderul tests_dir".

Comanda pentru a rula testele din tests_ex.py care conțin „squared":
pytest tests_ex.py -k "squared"
Semnificație: „Rulează framework-ul pytest folosind toate testele din scriptul tests_ex.py care conțin squared".
Output:

pytestscript_name.pydirectory_name/-k "keyword_expression"Introducere în testarea în Python