AssertionError when running with_plugs.py example
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- testing-qa
調査の方向性
まず with_plugs.py の例を実行し、80 行目付近の測定宣言を確認します。openhtf/util/validators.py の equals バリデータが受け取る前に、そのフェーズ引数がどのように処理されるかを追跡します。expected_retcode 引数がその整数値に置き換えられ、例が AssertionError なしで実行されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When running the with_plugs.py example. the following output is generated:
$ python3 with_plugs.py
Traceback (most recent call last):
File "with_plugs.py", line 80, in <module>
htf.Measurement('retcode').equals('{expected_retcode}', type=int)
File "/usr/lib/python3.8/site-packages/openhtf/core/measurements.py", line 257, in _with_validator
validators.create_validator(attr, *args, **kwargs))
File "/usr/lib/python3.8/site-packages/openhtf/util/validators.py", line 80, in create_validator
return _VALIDATORS[name](*args, **kwargs)
File "/usr/lib/python3.8/site-packages/openhtf/util/validators.py", line 175, in equals
assert type is None or issubclass(type, six.string_types), (
AssertionError: Cannot use a non-string type when matching a string
I believe this is being caused by the {expected_retcode} argument to the validator in the measurement not actually being substituted for the argument, so the validator sees its value argument as a string containing {expected_retcode} instead of an integer containing the value passed to the test.
# Note: phase name and total_time measurement use {} formatting with args
# passed into the phase so each phase has a unique name.
@htf.PhaseOptions(name='Ping-{pinger.host}-{count}')
@htf.plug(pinger=PingPlug.placeholder)
@htf.measures(
'total_time_{pinger.host}_{count}',
htf.Measurement('retcode').equals('{expected_retcode}', type=int)
)
I replaced the standard equals validator with this one:
class MyEquals(ValidatorBase):
def __init__(self, value, type=None):
self.value = value
self.type = type
def __call__(self, value):
print("type(value)) = " + str(type(value)))
print("self.type = " + str(self.type))
print("value = " + str(value))
print("self.value = " + str(self.value))
return type(value) == self.type and value == self.value
And this is the output I receive from the validator:
type(value)) = <class 'int'>
self.type = <class 'int'>
value = 0
self.value = {expected_retcode}
- 主要言語
- Python
- スター
- 723
- フォーク
- 239
- 平均マージ
- 3時間 17分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
google/openhtf のほかの issue
-
PERCENT double declaration対応中かも @Sanjays2402 が 83 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
google/openhtf#1250 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
google/openhtf#1219 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:core-platform effort:S priority:P3 status:in-review type:test
難易度 2/5 1時間未満 初心者へのやさしさ 80/100
randomparity/kdive#3246 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton massオープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
nf-core/metaboigniter#130 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
common-workflow-language/cwl-utils#477 ·
メンテナーはふだん 1 日以内に返信
-
Add dependabotオープンfeat
難易度 2/5 1時間未満 初心者へのやさしさ 72/100
open-nudge/opentemplate#204 ·
メンテナーはふだん 1 日以内に返信
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limit対応中かも @VascoSch92 が今日担当しました。 オープンpriority:medium ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
OpenHands/extensions#781 ·
メンテナーはふだん 1 日以内に返信