python - How to share the same instance for all methods of a pytest test class -


i have simple test class

@pytest.mark.incremental class testxyz:      def test_x(self):         print(self)      def test_y(self):         print(self)      def test_z(self):         print(self) 

when run following output:

test.testxyz object @ 0x7f99b729c9b0

test.testxyz object @ 0x7f99b7299b70

testtestxyz object @ 0x7f99b7287eb8

this indicates 3 methods called on 3 different instances of testxyz object. there anyway change behavior , make pytest call 3 methods on same object instance. can use self store values.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -