Skip to content

pytest does not show logs from failed tests #12987

Closed Answered by MRiabov
MRiabov asked this question in Q&A
Discussion options

You must be logged in to vote

Resolved: it was caused by a function which did this:

def (some_database = SomeDatabase()):...

And the init function of the SomeDatabase is this:

def__init__():
    arguments: dict = json.load("file.json")
    self.id=arguments["id"] #etc

I am using pyfakefs, and it seems that the smart python compiler has instantiated and cached SomeDatabase before filesystem mocks went into place. So the mocks were not instantiated and the filesystem tried to used the "production" file which threw the error.

That's one weird issue...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MRiabov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant