rewrite does not work automatically for plugins in develop mode #1934
Comments
Investigating further, I found that in development mode there's the Perhaps we should just try both |
nicoddemus
added a commit
to nicoddemus/pytest
that referenced
this issue
Sep 15, 2016
we might want add a general tool to do ahead of time assert rewriting and mark all plugin as always being rewritten |
(so that we can opt out of always marking them) |
skylarjhdownes
added a commit
to skylarjhdownes/pytest
that referenced
this issue
Sep 27, 2016
This was referenced Sep 29, 2016
This was referenced Feb 20, 2018
This was referenced Mar 5, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pytest-mock
uses pytest's assert introspection to enrich the error message when one of the standardmock.assert*
methods fail. Those asserts are in the plugin module (pytest_mock.py
), and while they are rewritten just fine when installed from a package, they don't get rewritten in development mode (python setup.py develop
).I tracked down the problem to our code which tries to rewrite all modules of installed plugins in
config.py
, function_consider_importhook
:When in development mode,
entrypoint.dist._get_metadata('RECORD')
returns an empty list; digging into that method I noticed it tries to access EGG metadata. Being in development mode, there's no EGG meta-data, so it makes sense.I think the only solution is to move the function which needs assertion rewriting to its own "util" module and call
register_assert_rewrite
before importing it (which is no big deal).Any other ideas on how to fix/workaround it?
cc @flub
The text was updated successfully, but these errors were encountered: