Hi Wolfgang,

On Thu, Feb 05, 2015 at 15:51 +0000, Wolfgang Schnerring wrote:
> Hi,
> 
> so I have some fixtures in package A, and I'm using said package from
> package B, which means I might want to write tests in B that re-use the
> fixtures from A.
> 
> If I understand the documentation correctly, mechanically I'd simply declare
> an entrypoint in A like this, correct? Or do I need implement some pytest_
> hook to share the fixtures?
>    entry_points = {
>         'pytest11': ['the_a_fixtures = package_a.conftest']
>     }
> 
> 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.

holger


> Thanks for any thoughts,
> Wolfgang
> 
> _______________________________________________
> pytest-dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/pytest-dev
> 
_______________________________________________
pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to