Skip to content

Commit

Permalink
Use httpd fixture per session to increase test runtime drasticallly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
whimboo authored Jun 12, 2024
1 parent b06af14 commit 396e0a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit 396e0a3

Please sign in to comment.