問題タブ [testinfra]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
pytest - pytest で収集時にフィクスチャを使用する
ansible transport で testinfra を使用しています。host
を備えたフィクスチャを提供するansible
ので、できますhost.ansible.get_variables()
。
次に、このインベントリの値に基づいてテストのパラメーター化を作成する必要があります。
在庫:
インベントリ内の各ホストの somedata からの「データ」をそれぞれテストするテストを作成したいと考えています。「各ホスト」の部分は testnfra によって処理されますが、テストのパラメーター化に苦労しています。
私は両方の方法を試しました:
@pytest.fixture(params=somedata)
->TypeError: 'function' object is not iterable
@pytest.fixture(params=somedata())
->Fixture "somedata" called directly. Fixtures are not meant to be called directly...
これどうやってするの?テスト時にテストの数を変更できないことは理解していますが、収集時に同じインベントリを持っていると確信しているので、理論的には実行可能です...
ansible - Molecule で testinfra をベリファイアとして使用するときにテストをデバッグする方法
分子ツールを使用して ansible ロールをテストし、testinfra(pytest) で結果を検証すると、特定の出力または ansible 変数を印刷またはデバッグできません。
それを行う方法はありますか?
python-3.x - testinfra - ansible 変数が正しく解釈されない
testinfraでは、 testinfra.modules.ansible.Ansibleget_variables()
のメソッドを使用して
いますが、 testinfraは私の Ansible 変数を評価できないようです。
私のポックについて説明しましょう。
私は2つの変数を定義しました:
myinventory.ini
は単純な localhost です:
次のような非常に単純なテストを作成しました。
pytest を実行すると、ここに私の sdtout があります:
ご覧のとおり、 variableone
で使用された場合、 variable は解釈されませんtwo
。
それで、これを行うことは可能ですか?
ご意見ありがとうございます !:)