mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 06:52:59 +00:00
Remove deprecated yield_fixture; add docstrings
This commit is contained in:
@@ -8,7 +8,7 @@ from getpass import getuser
|
||||
from subprocess import TimeoutExpired
|
||||
import time
|
||||
from unittest import mock
|
||||
from pytest import fixture, yield_fixture, raises
|
||||
from pytest import fixture, raises
|
||||
from tornado import ioloop
|
||||
|
||||
from .. import orm
|
||||
@@ -51,6 +51,7 @@ def io_loop():
|
||||
|
||||
@fixture(scope='module')
|
||||
def app(request):
|
||||
"""Mock a jupyterhub app for testing"""
|
||||
app = MockHub.instance(log_level=logging.DEBUG)
|
||||
app.start([])
|
||||
def fin():
|
||||
@@ -97,19 +98,23 @@ def _mockservice(request, app, url=False):
|
||||
service.proc.wait(1)
|
||||
return service
|
||||
|
||||
@yield_fixture
|
||||
|
||||
@fixture
|
||||
def mockservice(request, app):
|
||||
"""Mock a service with no external service url"""
|
||||
yield _mockservice(request, app, url=False)
|
||||
|
||||
@yield_fixture
|
||||
|
||||
@fixture
|
||||
def mockservice_url(request, app):
|
||||
"""Mock a service with its own url to test external services"""
|
||||
yield _mockservice(request, app, url=True)
|
||||
|
||||
@yield_fixture
|
||||
|
||||
@fixture
|
||||
def no_patience(app):
|
||||
"""Set slow-spawning timeouts to zero"""
|
||||
with mock.patch.dict(app.tornado_application.settings,
|
||||
{'slow_spawn_timeout': 0,
|
||||
'slow_stop_timeout': 0}):
|
||||
yield
|
||||
|
||||
|
Reference in New Issue
Block a user