From 4ac3e21132cbdd257e9dfbbc53703345bf581fee Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Thu, 8 Sep 2022 10:45:17 -0700 Subject: [PATCH 1/3] raise ceiling on jupyter_server dependency to < 3 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7c0fb6f..f9739fe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,7 +27,7 @@ include_package_data = True packages = find: python_requires = >=3.7 install_requires = - jupyter_server~=1.8 + jupyter_server>=1.8,<3 [options.data_files] etc/jupyter/jupyter_server_config.d = From e48741aa811a00a2f98374295df645d4f12692b3 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Thu, 8 Sep 2022 11:20:23 -0700 Subject: [PATCH 2/3] remove hack to read logs, making it compatible with traitlets 5.3 --- notebook_shim/tests/test_extension.py | 59 +++++++++------------------ 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/notebook_shim/tests/test_extension.py b/notebook_shim/tests/test_extension.py index 4242aa7..4776d57 100644 --- a/notebook_shim/tests/test_extension.py +++ b/notebook_shim/tests/test_extension.py @@ -9,38 +9,19 @@ @pytest.fixture -def extapp_log(): - """An io stream with the NotebookApp's logging output""" - stream = io.StringIO() - return stream - - -@pytest.fixture(autouse=True) -def extapp_logcapture(monkeypatch, extapp_log): - """""" - @default('log') - def _log_default(self): - """Start logging for this application. - The default is to log to stderr using a StreamHandler, if no default - handler already exists. The log level starts at logging.WARN, but this - can be adjusted by setting the ``log_level`` attribute. - """ - log = super(self.__class__, self)._log_default() - _log_handler = logging.StreamHandler(extapp_log) - _log_formatter = self._log_formatter_cls( - fmt=self.log_format, - datefmt=self.log_datefmt - ) - _log_handler.setFormatter(_log_formatter) - log.addHandler(_log_handler) - return log - - monkeypatch.setattr(MockExtensionApp, '_log_default', _log_default) - return _log_default +def read_app_logs(capsys): + """Fixture that returns a callable to read + the current output from the application's logs + that was printed to sys.stderr. + """ + def _inner(): + captured = capsys.readouterr() + return captured.err + return _inner @pytest.fixture -def jp_server_config(): +def jp_server_config(capsys): return { "ServerApp": { "jpserver_extensions": { @@ -77,13 +58,13 @@ def list_test_params(param_input): ]) ) def test_EXTAPP_AND_NBAPP_SHIM_MSG( + read_app_logs, extensionapp, - extapp_log, jp_argv, trait_name, trait_value ): - log = extapp_log.getvalue() + log = read_app_logs() # Verify a shim warning appeared. log_msg = shim.EXTAPP_AND_NBAPP_SHIM_MSG(trait_name, 'MockExtensionApp') assert log_msg in log @@ -99,13 +80,13 @@ def test_EXTAPP_AND_NBAPP_SHIM_MSG( ]) ) def test_EXTAPP_AND_SVAPP_SHIM_MSG( + read_app_logs, extensionapp, - extapp_log, jp_argv, trait_name, trait_value ): - log = extapp_log.getvalue() + log = read_app_logs() # Verify a shim warning appeared. log_msg = shim.EXTAPP_AND_SVAPP_SHIM_MSG(trait_name, 'MockExtensionApp') assert log_msg in log @@ -123,13 +104,13 @@ def test_EXTAPP_AND_SVAPP_SHIM_MSG( ]) ) def test_NOT_EXTAPP_NBAPP_AND_SVAPP_SHIM_MSG( + read_app_logs, extensionapp, - extapp_log, jp_argv, trait_name, trait_value ): - log = extapp_log.getvalue() + log = read_app_logs() # Verify a shim warning appeared. log_msg = shim.NOT_EXTAPP_NBAPP_AND_SVAPP_SHIM_MSG(trait_name, 'MockExtensionApp') assert log_msg in log @@ -144,13 +125,13 @@ def test_NOT_EXTAPP_NBAPP_AND_SVAPP_SHIM_MSG( ]) ) def test_EXTAPP_TO_SVAPP_SHIM_MSG( + read_app_logs, extensionapp, - extapp_log, jp_argv, trait_name, trait_value ): - log = extapp_log.getvalue() + log = read_app_logs() # Verify a shim warning appeared. log_msg = shim.EXTAPP_TO_SVAPP_SHIM_MSG(trait_name, 'MockExtensionApp') assert log_msg in log @@ -166,13 +147,13 @@ def test_EXTAPP_TO_SVAPP_SHIM_MSG( ]) ) def test_EXTAPP_TO_NBAPP_SHIM_MSG( + read_app_logs, extensionapp, - extapp_log, jp_argv, trait_name, trait_value ): - log = extapp_log.getvalue() + log = read_app_logs() # Verify a shim warning appeared. log_msg = shim.EXTAPP_TO_NBAPP_SHIM_MSG(trait_name, 'MockExtensionApp') assert log_msg in log From 5d9032c0294132ec7923819ddf1f373f2d705790 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Thu, 8 Sep 2022 11:25:39 -0700 Subject: [PATCH 3/3] set post version spec --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 24cb807..41db9ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,9 @@ testpaths = [ [tool.jupyter-releaser] skip = ["check-links"] +[tool.jupyter-releaser.options] +post-version-spec = "dev" + [tool.tbump.version] current = "0.2.0.dev0" regex = '''