概要 pytest の基本的な使い方を記載します。 適宜参照するための公式ドキュメントページ Full pytest documentation API Reference インストール 適当なパッケージマネージャ等でインストールできます。 sudo apt install python-pip pip install pytest which pytest /home/vagrant/.local/bin/pytest 実行方法 test_sample.py #!/usr/bin/python # -*- coding: utf-8 -*- class TestClass(object): def test_one(self): x = "this" assert 'h' in x def test_two(self): self.y = "hello" assert hasattr(s
![pytest の基本的な使い方](https://cdn-ak-scissors.b.st-hatena.com/image/square/3fcd90c016f40aded999ae6672210f3100fdb3b0/height=288;version=1;width=512/https%3A%2F%2Fdhs1l7yoal3vp.cloudfront.net%2Fuploads%2Fimage%2F771%2Fcontent%2Flarge-4d515e0b91b334d04862d2c8704b56eb.png%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Credential%3DAKIAIAKPQVZUBM64PATA%252F20240514%252Fap-northeast-1%252Fs3%252Faws4_request%26X-Amz-Date%3D20240514T112335Z%26X-Amz-Expires%3D900%26X-Amz-SignedHeaders%3Dhost%26X-Amz-Signature%3Dc682e21cacebe3e5f033b3469ac1b3070f4359573841c67ca03cf0bc1cd7a0e5)