<aside>
</aside>
function
, class
, module
, session
) κ°λ
λ° μ°¨μ΄μ μ€λͺ
autouse=True
μ΅μ
μΌλ‘ μλ μ μ© ν½μ€μ² λ§λ€κΈ° λ° νμ© μ¬λ‘ μ΄ν΄yield
λ¬ΈμΌλ‘ ν½μ€μ² λ΄ μ€μ (setup)κ³Ό μ 리(teardown) λ‘μ§ λΆλ¦¬ ꡬνrequest.addfinalizer
λ₯Ό μ΄μ©ν λ€λ₯Έ teardown μ²λ¦¬ λ°©λ² μκΈ°conftest.py
μ μ©μ± μ¬κ°μ‘° λ° μ΄ν΄νλ‘μ νΈ κ΅¬μ‘°:
graph TD
A(my-pytest-project) --> B(.venv);
A --> C(mycalc);
A --> D(tests);
C --> C1(__init__.py);
C --> C2(calculator.py);
D --> D1(__init__.py);
D --> D2(test_calculator.py);
D --> D3(conftest.py λ€μν μ€μ½ν ν½μ€μ² μΆκ°);
D --> D4(test_scopes.py μ€μ½ν νμΈμ©);
style B fill:#eee,stroke:#333,stroke-dasharray: 5 5;
style C fill:#ccf,stroke:#333;
style D fill:#cfc,stroke:#333;
style C2 fill:#cce,stroke:#333;
style D2 fill:#cef,stroke:#333;
style D3 fill:#fec,stroke:#333;
style D4 fill:#dff,stroke:#333;
tests/conftest.py
(λ€μν ν½μ€μ² μμ ):tests/test_scopes.py
(μ€μ½ν νμΈμ© ν
μ€νΈ νμΌ):-s
, -v
μ¬μ©):