Skip to content

Commit 2cd7111

Browse files
committed
some ruff fixes with newer ruf
1 parent d0e41f7 commit 2cd7111

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

pytest_jupyter/jupyter_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from pytest_jupyter.jupyter_core import * # noqa: F403
2424

2525

26-
@pytest.fixture()
26+
@pytest.fixture
2727
def jp_zmq_context():
2828
"""Get a zmq context."""
2929
import zmq
@@ -33,7 +33,7 @@ def jp_zmq_context():
3333
ctx.term()
3434

3535

36-
@pytest.fixture()
36+
@pytest.fixture
3737
def jp_start_kernel(jp_environ, jp_asyncio_loop):
3838
"""Get a function to a kernel and clean up resources when done."""
3939
kms = []

pytest_jupyter/jupyter_core.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,61 +66,61 @@ def pytest_pyfunc_call(pyfuncitem):
6666
return True
6767

6868

69-
@pytest.fixture()
69+
@pytest.fixture
7070
def jp_home_dir(tmp_path):
7171
"""Provides a temporary HOME directory value."""
7272
return mkdir(tmp_path, "home")
7373

7474

75-
@pytest.fixture()
75+
@pytest.fixture
7676
def jp_data_dir(tmp_path):
7777
"""Provides a temporary Jupyter data dir directory value."""
7878
return mkdir(tmp_path, "data")
7979

8080

81-
@pytest.fixture()
81+
@pytest.fixture
8282
def jp_config_dir(tmp_path):
8383
"""Provides a temporary Jupyter config dir directory value."""
8484
return mkdir(tmp_path, "config")
8585

8686

87-
@pytest.fixture()
87+
@pytest.fixture
8888
def jp_runtime_dir(tmp_path):
8989
"""Provides a temporary Jupyter runtime dir directory value."""
9090
return mkdir(tmp_path, "runtime")
9191

9292

93-
@pytest.fixture()
93+
@pytest.fixture
9494
def jp_system_jupyter_path(tmp_path):
9595
"""Provides a temporary Jupyter system path value."""
9696
return mkdir(tmp_path, "share", "jupyter")
9797

9898

99-
@pytest.fixture()
99+
@pytest.fixture
100100
def jp_env_jupyter_path(tmp_path):
101101
"""Provides a temporary Jupyter env system path value."""
102102
return mkdir(tmp_path, "env", "share", "jupyter")
103103

104104

105-
@pytest.fixture()
105+
@pytest.fixture
106106
def jp_system_config_path(tmp_path):
107107
"""Provides a temporary Jupyter config path value."""
108108
return mkdir(tmp_path, "etc", "jupyter")
109109

110110

111-
@pytest.fixture()
111+
@pytest.fixture
112112
def jp_env_config_path(tmp_path):
113113
"""Provides a temporary Jupyter env config path value."""
114114
return mkdir(tmp_path, "env", "etc", "jupyter")
115115

116116

117-
@pytest.fixture()
117+
@pytest.fixture
118118
def jp_kernel_dir(jp_data_dir):
119119
"""Get the directory for kernel specs."""
120120
return mkdir(jp_data_dir, "kernels")
121121

122122

123-
@pytest.fixture()
123+
@pytest.fixture
124124
def echo_kernel_spec(jp_kernel_dir):
125125
"""Install a kernel spec for the echo kernel."""
126126
test_dir = Path(jp_kernel_dir) / "echo"
@@ -132,7 +132,7 @@ def echo_kernel_spec(jp_kernel_dir):
132132
return str(test_dir)
133133

134134

135-
@pytest.fixture()
135+
@pytest.fixture
136136
def jp_environ( # noqa: PT004
137137
monkeypatch,
138138
tmp_path,

pytest_jupyter/jupyter_server.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
from pytest_jupyter.utils import mkdir
5555

5656

57-
@pytest.fixture()
57+
@pytest.fixture
5858
def 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
7272
def 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
7878
def 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
8484
def jp_argv():
8585
"""Allows tests to setup specific argv values."""
8686
return []
8787

8888

89-
@pytest.fixture()
89+
@pytest.fixture
9090
def 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
9797
def 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
103103
def 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
123123
def 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
139139
def 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
234234
def 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
240240
def 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
246246
def 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
254254
def 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
260260
def 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
316316
def 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
361361
def 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
397397
def 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
419419
def 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
436436
def 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
516516
def jp_server_authorizer(jp_server_auth_resources):
517517
"""An authorizer for the server."""
518518
auth_klass = _Authorizer

pytest_jupyter/pytest_tornasync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
from pytest_jupyter.jupyter_core import * # noqa: F403
1919

2020

21-
@pytest.fixture()
21+
@pytest.fixture
2222
def io_loop(jp_asyncio_loop):
2323
"""Get the current tornado event loop."""
2424
return tornado.ioloop.IOLoop.current()
2525

2626

27-
@pytest.fixture()
27+
@pytest.fixture
2828
def http_server(jp_asyncio_loop, http_server_port, jp_web_app):
2929
"""Start a tornado HTTP server that listens on all available interfaces."""
3030

@@ -47,15 +47,15 @@ async def get_server():
4747
http_server_port[0].close()
4848

4949

50-
@pytest.fixture()
50+
@pytest.fixture
5151
def http_server_port():
5252
"""
5353
Port used by `http_server`.
5454
"""
5555
return tornado.testing.bind_unused_port()
5656

5757

58-
@pytest.fixture()
58+
@pytest.fixture
5959
def http_server_client(http_server, jp_asyncio_loop):
6060
"""
6161
Create an asynchronous HTTP client that can fetch from `http_server`.

0 commit comments

Comments
 (0)