[py-dev] plugin scoping or control
I've run into an issue with pytest_assertrepr_compare - I want the hook to apply to only a subset of tests (tests/unit/**), so I defined tests/unit/conftest.py and defined my pytest_assertrepr_compare there, but still tests under tests/other/** get that behavior (when I run py.test on tests/). Is there a way to cause the hook to be loaded only for tests/unit/** (or some other subset of tests)? Alternatively, is there a way to detect from within the pytest_assertrepr_compare function which module/function is under test and select that way? Thanks, Jason
Hi Jason, On Thu, Sep 29, 2011 at 14:39 -0700, Jason R. Coombs wrote:
I've run into an issue with pytest_assertrepr_compare - I want the hook to apply to only a subset of tests (tests/unit/**), so I defined tests/unit/conftest.py and defined my pytest_assertrepr_compare there, but still tests under tests/other/** get that behavior (when I run py.test on tests/).
Is there a way to cause the hook to be loaded only for tests/unit/** (or some other subset of tests)? Alternatively, is there a way to detect from within the pytest_assertrepr_compare function which module/function is under test and select that way?
In principle it should be possible to have a conftest pytest_assertrepr_compare apply only to a subdirectory. The basic mechanism exists but this particular hook is implemented in a special way and thus it requires some thinking/hacking i am afraid. Could you open an issue about this? thanks, holger
Thanks,
Jason
_______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev
-----Original Message----- From: holger krekel [mailto:holger@merlinux.eu] Sent: Sunday, 02 October, 2011 23:37
Could you open an issue about this?
I've opened an issue as https://bitbucket.org/hpk42/pytest/issue/77/allow-assertrepr_compare-hook-to -apply. Thanks!
participants (2)
-
holger krekel -
Jason R. Coombs