Closed
Description
Hi, in my use case I need to set dinamically a self attribute of a test class with a command line option, without passing explicitly the parameter to the test definition, with a plugin.
For example:
# content test.py
class TestSuite():
my_cmd_opt = 'foo'
def test_case(self):
assert self.my_cmd_opt != 'foo' # here the test should pass because self.my_cmd_opt
# has been dinamically changed from pytest
so if i run:
$> pytest --set-my-cmd-opt=alpha test.py
test.py::TestSuite::test_case PASSED
because I've set self.my_cmd_opt to 'alpha' instead of 'foo'
There is a way to do that?
Metadata
Metadata
Assignees
Labels
No labels