Skip to content

Retrieve fixture directly #10223

Answered by The-Compiler
effigies asked this question in Q&A
Aug 16, 2022 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Couldn't you just have an autoused fixture which stores the fixture objects in the instance of the test object? Something like:

class MySuite(APITests):
    @pytest.fixture(autouse=True)
    def setup(self, tmp_path):
        self.tmp_path = tmp_path

    def validate_X(self, objmaker, params):
        tmp_path = self.tmp_path
        myobj = objmaker()
        # write tests based on params

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@effigies
Comment options

Answer selected by effigies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants