LoginSignup
0
0

More than 1 year has passed since last update.

Azure Functions (Python, pytest)でカバレッジを可視化する方法

Last updated at Posted at 2022-05-23

こちらの記事を参考に、Azure Functions (Python)のプロジェクトでも可視化できないか試行錯誤しました。

要点

.vscode\settings.jsonpython.testing.pytestArgsには--cov=.を指定する。

補足

--covにはソースコードのフォルダーを指定するものと思っていました。
そのため、AzureFunctionsの関数別のフォルダー名を複数指定していました。
それだと、Visual Studio Code上でカバレッジが可視化されませんでした。
拡張機能 coverage-gutters の Github Issuesで質問したところ、
開発者の方が確認してくださり、回答をいただけました。

URL: https://github.com/ryanluker/vscode-coverage-gutters/issues/373

それから、Pythonの仮想環境ではなく、ローカルのPythyonにcoverageパッケージも必要なようです。

サンプル

今回調べたことを元にサンプル プロジェクトを作成しました。
Azure Functions(Durable)のHTTPスターター、オーケストレーター、アクティビティのサンプル関数のテストコードとカバレッジの設定を行ったものです。

URL: https://github.com/ecormaksin/azure-durable-functions-pytest-coverage-sample

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0