# pytest.ini または pyproject.toml で定義 # markers = # slow: 時間がかかるテスト # integration: 統合テスト @pytest.mark.slow def test_heavy_computation(): # 時間がかかる処理 pass @pytest.mark.integration def test_api_integration ...
my_project/ ├── calculator.py # 関数本体 └── test_calculator.py # テスト # calculator.py """計算機モジュール""" def add(a, b): """ 2つの数を足す Args: a: 最初の数 b: 2番目の数 Returns: a + b の結果 """ # aとbを足して返す return a + b def ...
それでは、最初にプログラミングPythonに加えて「pytest」をインストールしましょう。Pythonのインストール方法はいろいろ ...