[Python] pytest でモックを使う方法(pytest-mock) 2021.02.12 Python pytest, pytest-mock, Python, テスト pytest でモックを利用する pytest を利用してテストをコーディングする場合にモックを利用したい場合、pytest-mock というライブラリを使うと便利です。 pytest-mock は mock パッケージの薄いラッパーを提供します。 この記事では pytest-mock を使ったいろいろなモックの使い方を紹介します。 pytest の基本的な使い方は以下の記事にまとめてます。 [Pytest] pytest 入門、テストコードを書く方法 │ Web備忘録 モックを利用するとテスト用で一時的に処理を差し替えてくれます。モック化した箇所は対象のテスト中においてのみモックとして扱われ、それ以外のテストで
![[Python] pytest でモックを使う方法(pytest-mock)](https://cdn-ak-scissors.b.st-hatena.com/image/square/737972c974f713f1e7d367748631572fe49b8f26/height=288;version=1;width=512/https%3A%2F%2Fwebbibouroku.com%2Fwp-content%2Fuploads%2Feye_python.png)