Skip to content

Commit b809b0c

Browse files
committed
add flake8 and pytest settings
1 parent e4f4472 commit b809b0c

File tree

7 files changed

+35
-36
lines changed

7 files changed

+35
-36
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ repos:
4848
- id: doc8
4949
args: [--max-line-length=200]
5050

51-
# - repo: https://github.com/pycqa/flake8
52-
# rev: 4.0.1
53-
# hooks:
54-
# - id: flake8
55-
# additional_dependencies:
56-
# [
57-
# "flake8-bugbear==20.1.4",
58-
# "flake8-logging-format==0.6.0",
59-
# "flake8-implicit-str-concat==0.2.0",
60-
# ]
51+
- repo: https://github.com/pycqa/flake8
52+
rev: 4.0.1
53+
hooks:
54+
- id: flake8
55+
additional_dependencies:
56+
[
57+
"flake8-bugbear==20.1.4",
58+
"flake8-logging-format==0.6.0",
59+
"flake8-implicit-str-concat==0.2.0",
60+
]
6161

6262
- repo: https://github.com/sirosen/check-jsonschema
6363
rev: 0.14.1

docs/source/conf.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,7 @@
268268

269269
# -- Options for LaTeX output ---------------------------------------------
270270

271-
latex_elements = {
272-
# The paper size ('letterpaper' or 'a4paper').
273-
#'papersize': 'letterpaper',
274-
# The font size ('10pt', '11pt' or '12pt').
275-
#'pointsize': '10pt',
276-
# Additional stuff for the LaTeX preamble.
277-
#'preamble': '',
278-
# Latex figure (float) alignment
279-
#'figure_align': 'htbp',
280-
}
271+
latex_elements = {}
281272

282273
# Grouping the document tree into LaTeX files. List of tuples
283274
# (source start file, target name, title,

jupyter_server_terminals/app.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@
1111
from jupyter_server.extension.application import ExtensionApp
1212
from jupyter_server.transutils import trans
1313
from jupyter_server.utils import run_sync_in_loop
14-
15-
# Tolerate missing terminado package.
16-
try:
17-
from .terminalmanager import TerminalManager
18-
19-
terminado_available = True
20-
except ImportError:
21-
terminado_available = False
22-
2314
except ModuleNotFoundError:
2415
raise ModuleNotFoundError("Jupyter Server must be installed to use this extension.")
2516

@@ -43,9 +34,7 @@ class TerminalsExtensionApp(ExtensionApp):
4334

4435
def initialize_settings(self):
4536
self.initialize_configurables()
46-
self.settings.update(
47-
dict(terminals_available=terminado_available, terminal_manager=self.terminal_manager)
48-
)
37+
self.settings.update(dict(terminals_available=True, terminal_manager=self.terminal_manager))
4938

5039
def initialize_configurables(self):
5140
if os.name == "nt":

jupyter_server_terminals/terminalmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _initialize_culler(self):
111111
"""
112112
if not self._initialized_culler and self.cull_inactive_timeout > 0:
113113
if self._culler_callback is None:
114-
loop = IOLoop.current()
114+
_ = IOLoop.current()
115115
if self.cull_interval <= 0: # handle case where user set invalid value
116116
self.log.warning(
117117
"Invalid value for 'cull_interval' detected (%s) - using default value (%s).",

pyproject.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ build-backend = "jupyter_packaging.build_api"
66
ignore = [""]
77

88
[tool.pytest.ini_options]
9-
addopts = "--doctest-modules"
9+
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
1010
testpaths = [
1111
"tests/"
1212
]
13+
timeout = 300
14+
# Restore this setting to debug failures
15+
# timeout_method = "thread"
16+
filterwarnings = [
17+
"error",
18+
# From tornado
19+
"ignore:unclosed <socket.socket:ResourceWarning",
20+
"ignore:There is no current event loop:DeprecationWarning",
21+
]
1322

1423
[tool.jupyter-releaser]
1524
skip = ["check-links"]

setup.cfg

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ test =
3636
pytest>=6.0
3737
pytest_tornasync
3838
pytest-cov
39+
pytest-timeout
3940
jupyter_server[test]>=1
4041

4142
[options.packages.find]
@@ -46,10 +47,19 @@ etc/jupyter/jupyter_server_config.d =
4647
jupyter-config/jupyter_server_terminals.json
4748

4849
[flake8]
49-
ignore = E, C, W, F403, F811, F841, E402, I100, I101, D400
50+
ignore = E501, W503, E402
5051
builtins = c, get_config
5152
exclude =
5253
.cache,
5354
.github,
5455
docs,
5556
setup.py
57+
enable-extensions = G
58+
extend-ignore =
59+
G001, G002, G004, G200, G201, G202,
60+
# black adds spaces around ':'
61+
E203,
62+
per-file-ignores =
63+
# B011: Do not call assert False since python -O removes these calls
64+
# F841 local variable 'foo' is assigned to but never used
65+
tests/*: B011, F841

tests/test_terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async def test_culling(jp_server_config, jp_fetch, jp_cleanup_subprocesses):
171171
last_activity = term["last_activity"]
172172

173173
culled = False
174-
for i in range(CULL_TIMEOUT + CULL_INTERVAL * 2):
174+
for _ in range(CULL_TIMEOUT + CULL_INTERVAL * 2):
175175
try:
176176
resp = await jp_fetch(
177177
"api",

0 commit comments

Comments
 (0)