Support parallel tests with external database
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 32/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- postgresql, python
- 領域
- databases, testing-qa
調査の方向性
まず、mutmut の現在の fork ベースの並列実行と、ミューテーション結果が foo.py.meta ファイルにどのように書き込まれるかを追跡します。pytest-xdist のドキュメントで説明されている worker と session-fixture の動作を比較します。並列 worker が分離された PostgreSQL データベースを初期化し、競合なくミューテーションを実行し、結果を安全に集約できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Similar to pytest-xdist: https://pytest-xdist.readthedocs.io/en/stable/how-to.html
I'm not sure yet how to implement this in mutmut, as the pytest setup is different (in pytest-xdist, session fixtures are run once per worker. Not sure how we could replicate this use case in mutmut)
I have a project which connects to a local postgres instance for integration tests. When running tests in parallel, they should connect to different databases on this instance, otherwise they would conflict with each other (e.g. test A deletes data from some table, while test B tries to read from this table). This means I currently cannot run these tests with mutmut.
The setup with pytest-xdist is:
- start e.g. 12 processes with
PYTEST_XDIST_WORKERset togw1,gw2, ..., gw12` - for each process, it runs the pytest session fixture to setup the database
2.1. The fixture connects to postgres and creates a databasetest_db_{PYTEST_XDIST_WORKER}
2.2. Afterwards, we have 12 different databases - When running a test, it runs against the
test_db_{PYTEST_XDIST_WORKER}database
Therefore, each worker uses its own database.
I think something like step (1) would be rather straightforward: We use fork and do not have explicit workers, but we run at most n processes in parallel. We could create n ids, keep track of which ids are still free, and everytime we fork another process we take one of the free ids.
However, I'm not sure how we would go about running session fixtures once per "worker". I suppose, we would could:
spawn(and notfork) 12 worker processes- set
MUTMUT_WORKER_1/2/.../12 - In each process run the complete test suite / an init method (for caching and running the database setup fixtures)
- Split the mutants across the workers (or use a multiprocessing queue/...)
- Inside of the worker, we sequentially run a single
forkto create isolated copies of the worker process (with everything already setup) and run tests for mutations there - Workers write their results into a results queue and the main process saves the stats in files (we should not write the
foo.py.metafiles from different processes)
- 主要言語
- Python
- スター
- 1.5k
- フォーク
- 185
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boxed/mutmut のほかの issue
-
Removing `not` from a parenthesized multi-line expression drops the parentheses (InvalidGeneratedSyntaxException, 3.8.0)対応中かも @jihtsan が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
`run` with a `name__mutmut_*` pattern runs the whole test suite in the clean-test check対応中かも @Ishaan400 が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
Invalid unary plus generated in match statement対応中かも @GhostCoder6969 が 27 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
letsencrypt/cp-cps#361 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
CI: startup_failure because callers grant fewer permissions than ledger-app-workflows@v1 declares対応中かも @maykonmichel が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
LedgerHQ/app-boilerplate-rust#227 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
linuxmint/mintupdate#1107 ·