Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "http" fixture per session to increase test runtime drasticallly #690

Merged
merged 2 commits into from
Jun 12, 2024
Merged
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
4 changes: 3 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
addopts = -vv --durations=5
log_cli = 1
markers =
ci_only: Only run these tests within the CI environment.

7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import base64
import os

import pytest
from urllib.parse import parse_qs, urlparse

from wptserve import (
handlers,
Expand Down Expand Up @@ -34,19 +32,22 @@ def basic_auth_handler(req, response):
response.content = content.format("restricted")


@pytest.fixture
@pytest.fixture(scope="session")
def httpd():
HERE = os.path.dirname(os.path.abspath(__file__))

routes = [
("GET", "/basic_auth", basic_auth_handler),
]
routes.extend(default_routes.routes)

httpd = server.WebTestHttpd(
host="127.0.0.1",
port=0,
doc_root=os.path.join(HERE, 'data'),
routes=routes,
)

httpd.start()
yield httpd
httpd.stop()
Expand Down
Loading