-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
22 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
import threading | ||
import time | ||
from mock_http_server import run_mock_server | ||
|
||
@pytest.fixture(scope="session") | ||
def mock_server(): | ||
"""Start the mock server once for the entire test suite.""" | ||
# Start server in a daemon thread | ||
server_thread = threading.Thread(target=run_mock_server) | ||
server_thread.daemon = True | ||
server_thread.start() | ||
|
||
# Give the server time to start | ||
time.sleep(1) | ||
|
||
yield server_thread | ||
|
||
@pytest.fixture(autouse=True) | ||
def use_mock_server(mock_server): | ||
"""Automatically use the mock server for all tests.""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters