Closed
Description
Question: How can I parameterize my tests with global variable which changes values on runtime.
I have a global list variable which I populate the value in one of the test and I am using this variable to parameterize another test. One way I found out was to use pickle. Is there any other way I can handle this scenario?
Example -
myList = []
def test_1():
global myList
myList = [1,2,3]
#This test should print 1,2,3
@pytest.mark.parameterize("num", myList)
def test_2(num):
print(num)