Skip to content

Where to place stub classes that are used to mock by several test packages? #10038

Discussion options

You must be logged in to vote

To add some more context to what I said in IRC: It's somewhat common for bigger projects to ship some kind of testing / test / test.utils / ... sub-package:

I don't see a reason why such a sub-package couldn't also contain mocks to use. Another approach (which I don't have an example of off-hand) is to ship a "fake backend" or "test backend" if some code already has multiple configurable backends to use for something.

Another approach you could take is to write a pytest plugin (say, pytest-A in your example) which is installable independently from A and provides the same functionality via pytest fixtures. If we're just talking about some mock classes, that se…

Replies: 1 comment 1 reply

Comment options

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

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