pytest-base-url icon indicating copy to clipboard operation
pytest-base-url copied to clipboard

Allow fixture scope to be customised

Open markhobson opened this issue 2 years ago • 1 comments

Some live servers support fixtures with a scope other than session, for example pytest-flask. When using a narrower scope with a custom base_url fixture, it is unable to be injected into the wider scoped _verify_url fixture:

ScopeMismatch: You tried to access the package scoped fixture base_url with a session scoped request object, involved factories:
.venv/lib/python3.12/site-packages/pytest_base_url/plugin.py:19:  def _verify_url(request, base_url)

Could the fixtures support dynamic scopes to resolve this?

markhobson avatar Dec 08 '23 11:12 markhobson

I'll welcome a PR that supports that!

BeyondEvil avatar Dec 09 '23 22:12 BeyondEvil