Category : teardown

Upon each setUp(), I am initialising the class myClass() which should initialise the variable my_var = []. And None upon tearDown(). test_1 works as expected. But test_2 doesn’t, self.my_class.my_var already contains the item added in the list from test_1. class MyClass: my_var = [] class TestMain(unittest.TestCase): def setUp(self): super(TestMain, self).setUp() self.my_class = MyClass() def tearDown(self): ..

Read more

Currently if test will fail from any reason the objects which were created in AWS service catalog(SC) can stay there after test is finished due all failed asserts stop script, so clean few lines after cant be invoked. Example of code: product_name,result=launchProduct(role, product, storagerole) logger.info("Creating pod with storagerole: {}".format(storagerole)) assert result, ‘Product ‘ + product ..

Read more

we have function called delete_product in assert which is called multiple times, how to remove all instances of delete_product and write one single function using pytest fixtures, code is below try: output = subprocess.check_output(cmd, shell=True).decode() except subprocess.CalledProcessError as error: logger.error("error: {}".format(error)) assert delete_product(role, product_name), ‘Product ‘ + product_name + ‘ could not be deleted by ..

Read more