Open jiasli opened 1 month ago
I think the reason for the TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name'
error is related to https://github.com/pytest-dev/pytest/issues/12289.
As ScenarioTest
is imported into examples/test_exapp
: https://github.com/microsoft/knack/blob/4acec273463deca92e579ca3141055a2923e3173/examples/test_exapp#L59
pytest
treats ScenarioTest
as a normal test class and calls its __init__
with method_name="runTest"
. However, knack.testsdk.base.ScenarioTest.__init__
requires 2 positional arguments:
resulting in the error.
On the other hand, azure.cli.testsdk.base.ScenarioTest
only has 1 positional argument:
class ScenarioTest(ReplayableTest, CheckerMixin, unittest.TestCase):
def __init__(self, method_name, config_file=None, recording_name=None,
recording_processors=None, replay_processors=None, recording_patches=None, replay_patches=None,
random_config_dir=False):
thus not having this issue.
First of all,
examples/test_exapp
cannot be directly executed bypytest
.After renaming it to
test_exapp.py
.pytest
fails with