# Advanced Python Testing 26 min read... This article is mostly for me to process my thoughts but also to pave a path for anyone that wants to follow a similar journey on some more advanced python testing topics. I recently had the opportunity to garbage collect a bunch of common libraries at my company into a new python library and git repository. Marking all the critical path libraries and copyi
この記事はBASE Advent Calendar 2019の20日目の記事です。 devblog.thebase.in PAY株式会社でテックリードを務める東と申します。 主にバックエンド全般に広く携わっています。最近はサーバーアプリばかり書いていますがインフラもわりとやります。 当ブログの読者の方には弊社のことをご存じない方もたくさんいらっしゃるかと思いますので、簡単に社の紹介をさせていただきます。 PAY株式会社はBASE株式会社の100%子会社で、オンライン決済サービス「PAY.JP」とID決済サービス「PAY ID」などの決済サービスを開発・運営している会社です。 「支払いのすべてをシンプルに」をミッションに掲げ、お金を扱うすべての事業者・個人がもっと豊かな生活ができることを目指しています。 さて、決済というミッションクリティカルなテーマを扱うにあたって、品質保証は最も重要な課題
※こちらはZeals AdventCalendar 12日目の記事です。 こんにちは! Pythonエンジニアの荒木です。 夏頃に社内の開発プロジェクトにPythonメンバーとしてアサインされ、本格的にPythonを業務で書くようになり、最近はほぼ毎日Pythonを書いています。 Pythonの業務としては主に新機能実装とDBリファクタリングをやっています。 今日はpytestのparametrizeの基本的な使い方と parametrizeでちょっと詰まったところがあったので、それらについて書きます。 目次は以下のようになります。 前提 parametrizeについて parametrize とは parametrize の使い方 fixtureをparametrizeする fixtureとは fixtureのparametrize 終わりに 前提 まず、以前にこちらの記事で紹介したよう
github.com pythonのyieldで指定するfixtureのやつを真似して実装してみた。意外と簡単にできるし。面白いし。便利な気がする。 yield fixture? pytestのfixtureはsetup/teardownをgeneratorで定義できる。昔はyield_fixtureという名前だったけれど。現在はfixture自体がその機能を保持するようになった。 pytest supports execution of fixture specific finalization code when the fixture goes out of scope. By using a yield statement instead of return, all the code after the yield statement serves as the teardown
Ian Cordasco is a maintainer, core developer, and creator of many open source libraries. Of note, Ian is a core developer of Requests and a maintainer of Flake8 as well as the founder of the Python Code Quality Authority (PyCQA). Introduction Requests is one of the most downloaded and widely used Python libraries published on PyPI. Testing Requests, however, is something that most people attempt t
DOKU188 If something goes wrong with your order, you'll get a full refund. Here's what's eligible: Your order doesn't match the item description or photos Your item arrived damaged Your item arrived after the estimated arrival window Your item didn't arrive or was lost in the mail View programme terms
Python + pytestにて、「pytest.raisesを使って例外をアサーションする」テストコードを作成する機会がありました。 ただ、書き方を誤りうまくアサーションできなかっため、メモを残します。 目次 環境 状況 原因 対応 ソースコード 環境 Python 3.6.0 unittest.mock.patchを使用 pytest 3.0.7 状況 テスト対象のメソッドtarget_method()は、以下とします。 pytest_raises.py from with_statement_library import Validator class Target(object): def target_method(self): """テスト対象のメソッド""" validator = Validator() validator.run() テスト対象クラスでimportしてい
Django + pytestでテストの初期化や後始末を書く場合、 django.test.TestCaseを使った、setUp()やtearDown() pytestを使った、classic xUnitスタイルのsetup_xxx()やteardown_xxx() pytestを使った、@fixtureのscope などのテストフィクスチャが使えます。 今回、それぞれがどのタイミングで動作するのか知りたくなったため、実際に試してみることにしました。 なお、pytest全体については以下が参考になりました。 [Python] 初中級者のためのpytest入門 - くろのて 目次 環境 django.test.TestCaseのsetUp/tearDownで書く pytestのxunitスタイルで書く pytestのfixtureで書く 今までのパターンを一つのテストクラスに書いてみる ソー
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く