[pytest-dev] Best practises for sharing fixtures

Wolfgang Schnerring wosc at wosc.de
Fri Feb 6 09:45:21 CET 2015


Hi,

* holger krekel <holger at merlinux.eu> [2015-02-06 08:40]:
> > Are there any best practises for namespacing / scoping the fixtures? Do I
> > have to take care in package A to prefix all my fixture names with
> > a_fixture1, a_fixture2 so that they do not clash in fixtures in package B?
> 
> There is no pytest mechanism for name scoping.  You could play with
> importing needed fixtures in package_b.conftest from package_a.conftest
> under a different name.  If package_a fixtures have dependencies on one
> another it won't easily work, though.  Therefore i guess using a prefix
> for the fixtures you want to share can make sense.

Yeah, I tried the importing route, that gets hairy really fast. :)
I'll go with prefixed names for now. Thanks for your input!

Wolfgang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20150206/a169592a/attachment.sig>


More information about the pytest-dev mailing list