How to achieve assertion rewriting for a helper module loaded directly from file? #8842
Unanswered
Midnighter
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @Midnighter, Here's how we do it: Lines 492 to 508 in 5016375 Seems like you need to iterate over |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using
importlib
to directly load a module from a file that would not (and should not) be discovered by pytest. However, currently I don't get any introspection of failed assertions within that module. Sadly, register_assert_rewrite does not seem to work in this case.I have the following minimal example structure:
Contents of
check.py
:and of
test_unit.py
:Output when I run this:
Can I force assertion writing in the
exec_module
call or afterward somehow? Thank you for your help.Beta Was this translation helpful? Give feedback.
All reactions