Skip to content

テストコード例をわかりやすくする #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from

Conversation

yattom
Copy link
Contributor

@yattom yattom commented May 11, 2021

pytestの最新バージョンで使える、わかりやすいパラメタ化テストやフィクスチャの書き方でテストコード例をわかりやすくする。

先行するPR #2 #3 #4 に依存しています。

@yattom
Copy link
Contributor Author

yattom commented May 11, 2021

コード例に含めたいものとして、下記を意識しています。

  • パラメタ化テスト
  • フィクスチャ (pytest式のsetUp)
  • テストを関数独立でも、クラスの中にも書ける
  • テスト失敗時のメッセージを書ける
  • Given/When/Then(準備/実行/検証)のステップ

意識して今回入れなかったもの:

  • 日本語テスト名
  • pytestの設定ファイル(pytest.iniなど)
  • 例外のテスト(withで書けてかっこいい)

@yattom
Copy link
Contributor Author

yattom commented May 11, 2021

別のPRに依存させてしまいましたが、内容的には独立できるはずなのに手順的にうっかりしました。
依存先のPRに問題あるようでしたら、tddbc/masterに対してPR作り直しますので、ご指摘ください。

@grimrose
Copy link
Member

Pythonらしい良いテストコードだと思います 👍

日本語テスト名

気になったので、これを意識して今回入れなかった理由があれば教えて下さい 🙏

@yattom
Copy link
Contributor Author

yattom commented May 12, 2021

日本語テスト名

気になったので、これを意識して今回入れなかった理由があれば教えて下さい 🙏

根拠はないのですが、

  • 日本語で問題のある環境があるかもしれない(結果出力とか)
  • 日本語を使えない人でも利用するかもしれない

と考えました。

@toshi-kawanishi
Copy link
Member

ありがとうございます 🙇‍♂️ #2 以降マージして良いかなと思うのですがどうでしょう?

@yattom
Copy link
Contributor Author

yattom commented May 13, 2021

ありがとうございます 🙇‍♂️ #2 以降マージして良いかなと思うのですがどうでしょう?

ありがとうございます。 #4 には疑義が出てるので、#2#3 をマージしてもらえたら、そこに #5 (本PR)の内容を作り直します

@yattom
Copy link
Contributor Author

yattom commented May 13, 2021

あ、私はマージ権限ないので、どなたかお願いします。念のため

@grimrose
Copy link
Member

#2 #3 mergeしました 👍

@yattom
Copy link
Contributor Author

yattom commented May 13, 2021

masterに対して #6 で作り直しました。こちらはクローズします。

@yattom yattom closed this May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants