エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Testing sys.exit() with pytest
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Testing sys.exit() with pytest
When I had tested code which had called sys.exit(), my usual approach was to use mock: def test_e... When I had tested code which had called sys.exit(), my usual approach was to use mock: def test_exit(mymodule): with mock.patch.object(mymodule.sys, "exit") as mock_exit: mymodule.should_exit() assert mock_exit.call_args[0][0] == 42There are few things I don’t like here: Mocking is always a bit of a black magic, as we stop threating code as black box and start poking inside of it.If sys.exit is ca