Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,8 @@ def _is_pytest_base_url_loaded(pluginmanager: pytest.PytestPluginManager) -> boo
class _BaseUrlFallback:
# Provides the base_url fixture when pytest-base-url is not in use.
@pytest.fixture(scope="session")
def base_url(self, pytestconfig: Any) -> Optional[str]:
@staticmethod
def base_url(pytestconfig: Any) -> Optional[str]:
return (
pytestconfig.getoption("--base-url")
or pytestconfig.getini("base_url")
Expand Down
3 changes: 2 additions & 1 deletion pytest-playwright/pytest_playwright/pytest_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,8 @@ def _is_pytest_base_url_loaded(pluginmanager: pytest.PytestPluginManager) -> boo
class _BaseUrlFallback:
# Provides the base_url fixture when pytest-base-url is not in use.
@pytest.fixture(scope="session")
def base_url(self, pytestconfig: Any) -> Optional[str]:
@staticmethod
def base_url(pytestconfig: Any) -> Optional[str]:
return (
pytestconfig.getoption("--base-url")
or pytestconfig.getini("base_url")
Expand Down
7 changes: 6 additions & 1 deletion tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ def test_base_url_without_pytest_base_url(
source: str,
) -> None:
# https://github.com/microsoft/playwright-pytest/issues/311
args = ["-p", "no:base_url"]
args = [
"-p",
"no:base_url",
"-W",
"error:session-scoped fixtures defined as instance methods:pytest.PytestDeprecationWarning",
]
if source == "option":
args += ["--base-url", test_server.PREFIX]
elif source == "ini":
Expand Down
7 changes: 6 additions & 1 deletion tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,12 @@ def test_base_url_without_pytest_base_url(
source: str,
) -> None:
# https://github.com/microsoft/playwright-pytest/issues/311
args = ["-p", "no:base_url"]
args = [
"-p",
"no:base_url",
"-W",
"error:session-scoped fixtures defined as instance methods:pytest.PytestDeprecationWarning",
]
if source == "option":
args += ["--base-url", test_server.PREFIX]
elif source == "ini":
Expand Down
Loading