5454from pytest_jupyter .utils import mkdir
5555
5656
57- @pytest .fixture ()
57+ @pytest .fixture
5858def jp_server_config ():
5959 """Allows tests to setup their specific configuration values."""
6060 if is_v2 :
@@ -68,38 +68,38 @@ def jp_server_config():
6868 return Config (config )
6969
7070
71- @pytest .fixture ()
71+ @pytest .fixture
7272def jp_root_dir (tmp_path ):
7373 """Provides a temporary Jupyter root directory value."""
7474 return mkdir (tmp_path , "root_dir" )
7575
7676
77- @pytest .fixture ()
77+ @pytest .fixture
7878def jp_template_dir (tmp_path ):
7979 """Provides a temporary Jupyter templates directory value."""
8080 return mkdir (tmp_path , "templates" )
8181
8282
83- @pytest .fixture ()
83+ @pytest .fixture
8484def jp_argv ():
8585 """Allows tests to setup specific argv values."""
8686 return []
8787
8888
89- @pytest .fixture ()
89+ @pytest .fixture
9090def jp_http_port (http_server_port ):
9191 """Returns the port value from the http_server_port fixture."""
9292 yield http_server_port [- 1 ]
9393 http_server_port [0 ].close ()
9494
9595
96- @pytest .fixture ()
96+ @pytest .fixture
9797def jp_extension_environ (jp_env_config_path , monkeypatch ): # noqa: PT004
9898 """Monkeypatch a Jupyter Extension's config path into each test's environment variable"""
9999 monkeypatch .setattr (serverextension , "ENV_CONFIG_PATH" , [str (jp_env_config_path )])
100100
101101
102- @pytest .fixture ()
102+ @pytest .fixture
103103def jp_nbconvert_templates (jp_data_dir ): # noqa: PT004
104104 """Setups up a temporary directory consisting of the nbconvert templates."""
105105
@@ -119,7 +119,7 @@ def jp_nbconvert_templates(jp_data_dir): # noqa: PT004
119119 shutil .copytree (nbconvert_path , str (nbconvert_target ))
120120
121121
122- @pytest .fixture ()
122+ @pytest .fixture
123123def jp_logging_stream ():
124124 """StringIO stream intended to be used by the core
125125 Jupyter ServerApp logger's default StreamHandler. This
@@ -135,7 +135,7 @@ def jp_logging_stream():
135135 return output
136136
137137
138- @pytest .fixture ()
138+ @pytest .fixture
139139def jp_configurable_serverapp (
140140 jp_nbconvert_templates , # this fixture must precede jp_environ
141141 jp_environ ,
@@ -230,33 +230,33 @@ async def initialize_app():
230230 return _configurable_serverapp
231231
232232
233- @pytest .fixture ()
233+ @pytest .fixture
234234def jp_serverapp (jp_server_config , jp_argv , jp_configurable_serverapp ):
235235 """Starts a Jupyter Server instance based on the established configuration values."""
236236 return jp_configurable_serverapp (config = jp_server_config , argv = jp_argv )
237237
238238
239- @pytest .fixture ()
239+ @pytest .fixture
240240def jp_web_app (jp_serverapp ):
241241 """app fixture is needed by pytest_tornasync plugin"""
242242 return jp_serverapp .web_app
243243
244244
245- @pytest .fixture ()
245+ @pytest .fixture
246246def jp_auth_header (jp_serverapp ):
247247 """Configures an authorization header using the token from the serverapp fixture."""
248248 if not is_v2 :
249249 return {"Authorization" : f"token { jp_serverapp .token } " }
250250 return {"Authorization" : f"token { jp_serverapp .identity_provider .token } " }
251251
252252
253- @pytest .fixture ()
253+ @pytest .fixture
254254def jp_base_url ():
255255 """Returns the base url to use for the test."""
256256 return "/a%40b/"
257257
258258
259- @pytest .fixture ()
259+ @pytest .fixture
260260def jp_fetch (jp_serverapp , http_server_client , jp_auth_header , jp_base_url ):
261261 """Sends an (asynchronous) HTTP request to a test server.
262262 The fixture is a factory; it can be called like
@@ -312,7 +312,7 @@ def client_fetch(*parts, headers=None, params=None, **kwargs):
312312 return client_fetch
313313
314314
315- @pytest .fixture ()
315+ @pytest .fixture
316316def jp_ws_fetch (jp_serverapp , http_server_client , jp_auth_header , jp_http_port , jp_base_url ):
317317 """Sends a websocket request to a test server.
318318 The fixture is a factory; it can be called like
@@ -357,7 +357,7 @@ def client_fetch(*parts, headers=None, params=None, **kwargs):
357357 return client_fetch
358358
359359
360- @pytest .fixture ()
360+ @pytest .fixture
361361def jp_create_notebook (jp_root_dir ):
362362 """Creates a notebook in the test's home directory."""
363363
@@ -393,7 +393,7 @@ def jp_server_cleanup(jp_asyncio_loop): # noqa: PT004
393393 ServerApp .clear_instance ()
394394
395395
396- @pytest .fixture ()
396+ @pytest .fixture
397397def send_request (jp_fetch , jp_ws_fetch ):
398398 """Send to Jupyter Server and return response code."""
399399
@@ -415,7 +415,7 @@ async def _(url, **fetch_kwargs):
415415 return _
416416
417417
418- @pytest .fixture ()
418+ @pytest .fixture
419419def jp_server_auth_core_resources ():
420420 """The core auth resources for use with a server."""
421421 modules = []
@@ -432,7 +432,7 @@ def jp_server_auth_core_resources():
432432 return resource_map
433433
434434
435- @pytest .fixture ()
435+ @pytest .fixture
436436def jp_server_auth_resources (jp_server_auth_core_resources ):
437437 """The auth resources used by the server."""
438438 return jp_server_auth_core_resources
@@ -512,7 +512,7 @@ def is_authorized(self, handler, user, action, resource): # noqa: ARG002
512512 )
513513
514514
515- @pytest .fixture ()
515+ @pytest .fixture
516516def jp_server_authorizer (jp_server_auth_resources ):
517517 """An authorizer for the server."""
518518 auth_klass = _Authorizer
0 commit comments