<aside>
</aside>
pytest
๋ช
๋ น์ด ๋ค์ํ ์คํ ์ต์
(ํ๋๊ทธ) ์ฌ์ฉ๋ฒ ์์งv
์ต์
์ผ๋ก ์์ธํ ํ
์คํธ ์คํ ๊ฒฐ๊ณผ ํ์ธk
์ต์
์ผ๋ก ํน์ ํค์๋ ํฌํจ ํ
์คํธ ์ ํ์ ์คํํ๋ก์ ํธ ๊ตฌ์กฐ: (๋ณ๋ ์์)
graph TD
A(my-pytest-project) --> B(.venv);
A --> C(mycalc);
A --> D(tests);
C --> C1(__init__.py);
C --> C2(mycalc.py);
D --> D1(__init__.py);
D --> D2(test_mycalc.py);
style B fill:#eee,stroke:#333,stroke-dasharray: 5 5;
style C fill:#ccf,stroke:#333;
style D fill:#cfc,stroke:#333;
mycalc/mycalc.py
(์์ค ์ฝ๋): (๋ณ๋ ์์)tests/test_mycalc.py
(ํ
์คํธ ์ฝ๋ - ์คํจ ์์ ์ถ๊ฐ):๋ช
๋ น์ด: pytest
(ํ์ฌ ๋๋ ํ ๋ฆฌ ๋ฐ ํ์์์ ๋ชจ๋ ํ
์คํธ ์คํ)
test_fail_example
์ถ๊ฐ ํ ์์ ๊ฒฐ๊ณผ:
============================= test session starts ==============================
platform ... -- Python 3.x.x, pytest-8.x.x, ...
rootdir: ...
collected 4 items
tests\\\\test_mycalc.py ...F [100%]
=================================== FAILURES ===================================
_____________________________ test_fail_example ______________________________
# ... (์คํจ ์ ๋ณด ์์ธ ๋ด์ฉ) ...
=========================== short test summary info ============================
FAILED tests/test_mycalc.py::test_fail_example - assert 2 == 3
========================= 1 failed, 3 passed in ...s =========================
1 failed, 3 passed
: 4๊ฐ ์ค 3๊ฐ ํต๊ณผ, 1๊ฐ ์คํจ.