pytest-girder 5.0.8.dev2__tar.gz → 5.0.8.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_girder-5.0.8.dev2/pytest_girder.egg-info → pytest_girder-5.0.8.dev6}/PKG-INFO +1 -1
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/fixtures.py +53 -4
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6/pytest_girder.egg-info}/PKG-INFO +1 -1
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/LICENSE +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/MANIFEST.in +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pyproject.toml +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/__init__.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/assertions.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/plugin.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/plugin_registry.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/utils.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder/web_client.py +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/SOURCES.txt +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/dependency_links.txt +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/entry_points.txt +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/requires.txt +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/top_level.txt +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/setup.cfg +0 -0
- {pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/setup.py +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import os
|
|
3
3
|
import shutil
|
|
4
|
+
import threading
|
|
5
|
+
import time
|
|
4
6
|
import unittest.mock
|
|
5
7
|
|
|
6
8
|
import mongomock
|
|
7
9
|
import pytest
|
|
8
10
|
|
|
9
11
|
from .plugin_registry import PluginRegistry
|
|
10
|
-
from .utils import serverContext
|
|
12
|
+
from .utils import _findFreePort, serverContext
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
def _uid(node):
|
|
@@ -145,6 +147,52 @@ def boundServer(db, request):
|
|
|
145
147
|
yield server
|
|
146
148
|
|
|
147
149
|
|
|
150
|
+
@pytest.fixture
|
|
151
|
+
def asgiBoundServer(db, request):
|
|
152
|
+
"""
|
|
153
|
+
Require an ASGI server that listens on a port.
|
|
154
|
+
|
|
155
|
+
Provides a started uvicorn server with a bound port. The returned value has
|
|
156
|
+
a `boundPort` property identifying where the server can be reached.
|
|
157
|
+
"""
|
|
158
|
+
import uvicorn
|
|
159
|
+
|
|
160
|
+
from girder.asgi import _WSGIBridge
|
|
161
|
+
|
|
162
|
+
registry = PluginRegistry()
|
|
163
|
+
with registry():
|
|
164
|
+
plugins = _getPluginsFromMarker(request, registry)
|
|
165
|
+
with serverContext(plugins, bindPort=False) as server_fixture:
|
|
166
|
+
port = _findFreePort()
|
|
167
|
+
server_fixture.boundPort = port
|
|
168
|
+
config = uvicorn.Config(
|
|
169
|
+
_WSGIBridge(server_fixture.serverRoot),
|
|
170
|
+
host='127.0.0.1',
|
|
171
|
+
port=port,
|
|
172
|
+
log_level='warning',
|
|
173
|
+
server_header=False,
|
|
174
|
+
date_header=False,
|
|
175
|
+
lifespan='off',
|
|
176
|
+
access_log=False,
|
|
177
|
+
loop='asyncio',
|
|
178
|
+
)
|
|
179
|
+
asgi_server = uvicorn.Server(config)
|
|
180
|
+
thread = threading.Thread(target=asgi_server.run, daemon=True)
|
|
181
|
+
thread.start()
|
|
182
|
+
deadline = time.monotonic() + 10
|
|
183
|
+
while not asgi_server.started and thread.is_alive() and time.monotonic() < deadline:
|
|
184
|
+
time.sleep(0.01)
|
|
185
|
+
if not asgi_server.started:
|
|
186
|
+
asgi_server.should_exit = True
|
|
187
|
+
thread.join(timeout=5)
|
|
188
|
+
raise RuntimeError('ASGI server failed to start')
|
|
189
|
+
try:
|
|
190
|
+
yield server_fixture
|
|
191
|
+
finally:
|
|
192
|
+
asgi_server.should_exit = True
|
|
193
|
+
thread.join(timeout=5)
|
|
194
|
+
|
|
195
|
+
|
|
148
196
|
@pytest.fixture
|
|
149
197
|
def email_stdout(db):
|
|
150
198
|
old_env_val = os.environ.get('GIRDER_EMAIL_TO_CONSOLE')
|
|
@@ -209,11 +257,12 @@ def fsAssetstore(db, request):
|
|
|
209
257
|
|
|
210
258
|
__all__ = (
|
|
211
259
|
'admin',
|
|
260
|
+
'asgiBoundServer',
|
|
261
|
+
'boundServer',
|
|
212
262
|
'db',
|
|
263
|
+
'eagerWorkerTasks',
|
|
264
|
+
'email_stdout',
|
|
213
265
|
'fsAssetstore',
|
|
214
266
|
'server',
|
|
215
|
-
'boundServer',
|
|
216
267
|
'user',
|
|
217
|
-
'email_stdout',
|
|
218
|
-
'eagerWorkerTasks',
|
|
219
268
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytest_girder-5.0.8.dev2 → pytest_girder-5.0.8.dev6}/pytest_girder.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|