From eb10a7a711e10045c0de6449c76105d7842c083b Mon Sep 17 00:00:00 2001 From: Amogh M Aradhya Date: Thu, 14 Dec 2023 12:42:19 +0530 Subject: [PATCH] Enable pytest socket to all the tests using live_server fixture --- tests/e2e/basic/video_test.py | 2 -- tests/e2e/conftest.py | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/e2e/basic/video_test.py b/tests/e2e/basic/video_test.py index 128acce8b..51c968d79 100644 --- a/tests/e2e/basic/video_test.py +++ b/tests/e2e/basic/video_test.py @@ -1,6 +1,5 @@ """Test livestream urls.""" -import pytest from playwright.sync_api import Page, expect VETINARI_EMAIL = 'vetinari@example.org' @@ -14,7 +13,6 @@ def wait_until_recaptcha_loaded(page: Page) -> None: ) -@pytest.mark.enable_socket() def test_login_add_livestream( db_session, live_server, user_vetinari, project_expo2010, page: Page ): diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index c867f8843..48f340257 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -2,7 +2,6 @@ # pylint: disable=redefined-outer-name import pytest -from pytest_socket import enable_socket @pytest.fixture() @@ -11,5 +10,7 @@ def db_session(db_session_truncate): return db_session_truncate -def pytest_runtest_setup() -> None: - enable_socket() +def pytest_collection_modifyitems(items): + for item in items: + if 'live_server' in getattr(item, 'fixturenames', ()): + item.add_marker(pytest.mark.enable_socket())