From ffa35ca31d7f635475cb3323ed309d1790b50d50 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Tue, 18 Jan 2022 10:46:08 -0800 Subject: [PATCH 1/8] make unit tests backwards compatible to pending kernels --- jupyter_server/tests/services/sessions/test_api.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jupyter_server/tests/services/sessions/test_api.py b/jupyter_server/tests/services/sessions/test_api.py index 445d4dad4c..c32e0890a1 100644 --- a/jupyter_server/tests/services/sessions/test_api.py +++ b/jupyter_server/tests/services/sessions/test_api.py @@ -142,12 +142,14 @@ def session_is_ready(jp_serverapp): """ async def _(session_id): - sm = jp_serverapp.session_manager mkm = jp_serverapp.kernel_manager - session = await sm.get_session(session_id=session_id) - kernel_id = session["kernel"]["id"] - kernel = mkm.get_kernel(kernel_id) - await kernel.ready + if getattr(mkm, "use_pending_kernels", False): + sm = jp_serverapp.session_manager + session = await sm.get_session(session_id=session_id) + kernel_id = session["kernel"]["id"] + kernel = mkm.get_kernel(kernel_id) + if getattr(kernel, "ready"): + await kernel.ready return _ From 9faf5261b9be289fc5a40c9941b510ec13b39670 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Tue, 18 Jan 2022 13:16:53 -0800 Subject: [PATCH 2/8] add pytest doctest flags to workflow --- .github/workflows/python-linux.yml | 4 ++-- .github/workflows/python-macos.yml | 4 ++-- .github/workflows/python-windows.yml | 2 +- pyproject.toml | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-linux.yml b/.github/workflows/python-linux.yml index 2f69cdaccd..d0f8520ec5 100644 --- a/.github/workflows/python-linux.yml +++ b/.github/workflows/python-linux.yml @@ -51,11 +51,11 @@ jobs: - name: Run the tests if: ${{ matrix.python-version != 'pypy-3.7' }} run: | - pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered + pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --doctest-modules - name: Run the tests on pypy if: ${{ matrix.python-version == 'pypy-3.7' }} run: | - pytest -vv jupyter_server + pytest -vv jupyter_server --doctest-modules - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/.github/workflows/python-macos.yml b/.github/workflows/python-macos.yml index 14f24c4318..7831d63422 100644 --- a/.github/workflows/python-macos.yml +++ b/.github/workflows/python-macos.yml @@ -27,11 +27,11 @@ jobs: - name: Run the tests if: ${{ !startsWith( matrix.python-version, 'pypy' ) }} run: | - pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered + pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --doctest-modules - name: Run the tests on pypy if: ${{ startsWith( matrix.python-version, 'pypy' ) }} run: | - pytest -vv jupyter_server + pytest -vv jupyter_server --doctest-modules - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/.github/workflows/python-windows.yml b/.github/workflows/python-windows.yml index a9e1c7c467..fad3236931 100644 --- a/.github/workflows/python-windows.yml +++ b/.github/workflows/python-windows.yml @@ -31,7 +31,7 @@ jobs: # the file descriptions opened by the asyncio IOLoop. # This leads to a nasty, flaky race condition that we haven't # been able to solve. - pytest -vv -s jupyter_server + pytest -vv -s jupyter_server --doctest-modules - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/pyproject.toml b/pyproject.toml index 12b2e02174..bd172c53cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ factory = "jupyter_packaging.npm_builder" ignore = ["tbump.toml", ".*", "*.yml", "package-lock.json", "bootstrap*", "conftest.py"] [tool.pytest.ini_options] -addopts = "--doctest-modules" testpaths = [ "jupyter_server/" ] From 899fa224495a8f581769730817328549f5180aef Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 12:34:20 -0800 Subject: [PATCH 3/8] make kernel shutdown in unit tests aggressive --- jupyter_server/pytest_plugin.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jupyter_server/pytest_plugin.py b/jupyter_server/pytest_plugin.py index 2d3b66bf1d..acf93b25b4 100644 --- a/jupyter_server/pytest_plugin.py +++ b/jupyter_server/pytest_plugin.py @@ -476,6 +476,20 @@ def jp_cleanup_subprocesses(jp_serverapp): async def _(): terminal_cleanup = jp_serverapp.web_app.settings["terminal_manager"].terminate_all kernel_cleanup = jp_serverapp.kernel_manager.shutdown_all + + async def kernel_cleanup_steps(): + # Try a graceful shutdown with a timeout + try: + await asyncio.wait_for(kernel_cleanup(), timeout=15.0) + except asyncio.TimeoutError: + # Now force a shutdown + try: + await asyncio.wait_for(kernel_cleanup(now=True), timeout=15.0) + except asyncio.TimeoutError: + print(Exception("Kernel never shutdown!")) + except Exception as e: + print(e) + if asyncio.iscoroutinefunction(terminal_cleanup): try: await terminal_cleanup() @@ -487,10 +501,7 @@ async def _(): except Exception as e: print(e) if asyncio.iscoroutinefunction(kernel_cleanup): - try: - await kernel_cleanup() - except Exception as e: - print(e) + await kernel_cleanup_steps() else: try: kernel_cleanup() From 109f00143557f6f5f5f9b71502e593c1af372c8b Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 13:01:57 -0800 Subject: [PATCH 4/8] add timeouts and better session teardown in unit tests --- .../tests/services/kernels/test_cull.py | 1 + .../tests/services/sessions/test_api.py | 49 ++++++++++++++----- setup.cfg | 1 + 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/jupyter_server/tests/services/kernels/test_cull.py b/jupyter_server/tests/services/kernels/test_cull.py index 3f75ed54ee..e2b5f0f400 100644 --- a/jupyter_server/tests/services/kernels/test_cull.py +++ b/jupyter_server/tests/services/kernels/test_cull.py @@ -89,6 +89,7 @@ async def test_cull_idle(jp_fetch, jp_ws_fetch, jp_cleanup_subprocesses): ) ], ) +@pytest.mark.timeout(30) async def test_cull_dead( jp_fetch, jp_ws_fetch, jp_serverapp, jp_cleanup_subprocesses, jp_kernelspecs ): diff --git a/jupyter_server/tests/services/sessions/test_api.py b/jupyter_server/tests/services/sessions/test_api.py index c32e0890a1..21b4b25cc2 100644 --- a/jupyter_server/tests/services/sessions/test_api.py +++ b/jupyter_server/tests/services/sessions/test_api.py @@ -197,9 +197,7 @@ def assert_session_equality(actual, expected): assert_kernel_equality(actual["kernel"], expected["kernel"]) -async def test_create( - session_client, jp_base_url, jp_cleanup_subprocesses, jp_serverapp, session_is_ready -): +async def test_create(session_client, jp_base_url, jp_cleanup_subprocesses, jp_serverapp): # Make sure no sessions exist. resp = await session_client.list() sessions = j(resp) @@ -295,22 +293,30 @@ async def test_create_bad_pending( await jp_cleanup_subprocesses() -async def test_create_file_session(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_create_file_session( + session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/nb1.py", type="file") assert resp.code == 201 newsession = j(resp) assert newsession["path"] == "foo/nb1.py" assert newsession["type"] == "file" + sid = newsession["id"] + await session_is_ready(sid) await jp_cleanup_subprocesses() -async def test_create_console_session(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_create_console_session( + session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/abc123", type="console") assert resp.code == 201 newsession = j(resp) assert newsession["path"] == "foo/abc123" assert newsession["type"] == "console" # Need to find a better solution to this. + sid = newsession["id"] + await session_is_ready(sid) await jp_cleanup_subprocesses() @@ -322,6 +328,7 @@ async def test_create_deprecated(session_client, jp_cleanup_subprocesses, jp_ser assert newsession["type"] == "notebook" assert newsession["notebook"]["path"] == "foo/nb1.ipynb" # Need to find a better solution to this. + sid = newsession["id"] await jp_cleanup_subprocesses() @@ -356,10 +363,15 @@ async def test_create_with_kernel_id( await jp_cleanup_subprocesses() -async def test_create_with_bad_kernel_id(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_create_with_bad_kernel_id( + session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/nb1.py", type="file") assert resp.code == 201 newsession = j(resp) + sid = newsession["id"] + await session_is_ready(sid) + # TODO assert newsession["path"] == "foo/nb1.py" assert newsession["type"] == "file" @@ -387,10 +399,11 @@ async def test_delete(session_client, jp_cleanup_subprocesses, jp_serverapp, ses await jp_cleanup_subprocesses() -async def test_modify_path(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_modify_path(session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready): resp = await session_client.create("foo/nb1.ipynb") newsession = j(resp) sid = newsession["id"] + await session_is_ready(sid) resp = await session_client.modify_path(sid, "nb2.ipynb") changed = j(resp) @@ -400,10 +413,13 @@ async def test_modify_path(session_client, jp_cleanup_subprocesses, jp_serverapp await jp_cleanup_subprocesses() -async def test_modify_path_deprecated(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_modify_path_deprecated( + session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/nb1.ipynb") newsession = j(resp) sid = newsession["id"] + await session_is_ready(sid) resp = await session_client.modify_path_deprecated(sid, "nb2.ipynb") changed = j(resp) @@ -413,10 +429,11 @@ async def test_modify_path_deprecated(session_client, jp_cleanup_subprocesses, j await jp_cleanup_subprocesses() -async def test_modify_type(session_client, jp_cleanup_subprocesses, jp_serverapp): +async def test_modify_type(session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready): resp = await session_client.create("foo/nb1.ipynb") newsession = j(resp) sid = newsession["id"] + await session_is_ready(sid) resp = await session_client.modify_type(sid, "console") changed = j(resp) @@ -426,10 +443,13 @@ async def test_modify_type(session_client, jp_cleanup_subprocesses, jp_serverapp await jp_cleanup_subprocesses() -async def test_modify_kernel_name(session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp): +async def test_modify_kernel_name( + session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/nb1.ipynb") before = j(resp) sid = before["id"] + await session_is_ready(sid) resp = await session_client.modify_kernel_name(sid, before["kernel"]["name"]) after = j(resp) @@ -450,10 +470,13 @@ async def test_modify_kernel_name(session_client, jp_fetch, jp_cleanup_subproces await jp_cleanup_subprocesses() -async def test_modify_kernel_id(session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp): +async def test_modify_kernel_id( + session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp, session_is_ready +): resp = await session_client.create("foo/nb1.ipynb") before = j(resp) sid = before["id"] + await session_is_ready(sid) # create a new kernel resp = await jp_fetch("api/kernels", method="POST", allow_nonstandard_methods=True) @@ -482,7 +505,7 @@ async def test_modify_kernel_id(session_client, jp_fetch, jp_cleanup_subprocesse async def test_restart_kernel( - session_client, jp_base_url, jp_fetch, jp_ws_fetch, jp_cleanup_subprocesses + session_client, jp_base_url, jp_fetch, jp_ws_fetch, jp_cleanup_subprocesses, session_is_ready ): # Create a session. resp = await session_client.create("foo/nb1.ipynb") @@ -494,6 +517,8 @@ async def test_restart_kernel( assert resp.headers["Location"] == url_path_join( jp_base_url, "/api/sessions/", new_session["id"] ) + sid = new_session["id"] + await session_is_ready(sid) kid = new_session["kernel"]["id"] diff --git a/setup.cfg b/setup.cfg index fe0bbc86aa..b7f704c6a7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,6 +50,7 @@ test = pytest>=6.0 pytest-cov pytest-mock + pytest-timeout requests pytest-tornasync pytest-console-scripts From 05e3532fe96689570c5aed9511f207b9ed1ee3ab Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 13:15:25 -0800 Subject: [PATCH 5/8] add timeouts --- .../tests/services/kernels/test_api.py | 9 +++++++++ .../tests/services/sessions/test_api.py | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/jupyter_server/tests/services/kernels/test_api.py b/jupyter_server/tests/services/kernels/test_api.py index aae3885b2e..37943a24ad 100644 --- a/jupyter_server/tests/services/kernels/test_api.py +++ b/jupyter_server/tests/services/kernels/test_api.py @@ -12,6 +12,9 @@ from jupyter_server.utils import url_path_join +TEST_TIMEOUT = 20 + + @pytest.fixture def pending_kernel_is_ready(jp_serverapp): async def _(kernel_id): @@ -63,6 +66,7 @@ async def test_no_kernels(jp_fetch): assert kernels == [] +@pytest.mark.timeout(TEST_TIMEOUT) async def test_default_kernels(jp_fetch, jp_base_url, jp_cleanup_subprocesses): r = await jp_fetch("api", "kernels", method="POST", allow_nonstandard_methods=True) kernel = json.loads(r.body.decode()) @@ -78,6 +82,7 @@ async def test_default_kernels(jp_fetch, jp_base_url, jp_cleanup_subprocesses): await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_main_kernel_handler( jp_fetch, jp_base_url, jp_cleanup_subprocesses, jp_serverapp, pending_kernel_is_ready ): @@ -146,6 +151,7 @@ async def test_main_kernel_handler( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_kernel_handler(jp_fetch, jp_cleanup_subprocesses, pending_kernel_is_ready): # Create a kernel r = await jp_fetch( @@ -193,6 +199,7 @@ async def test_kernel_handler(jp_fetch, jp_cleanup_subprocesses, pending_kernel_ await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_kernel_handler_startup_error( jp_fetch, jp_cleanup_subprocesses, jp_serverapp, jp_kernelspecs ): @@ -204,6 +211,7 @@ async def test_kernel_handler_startup_error( await jp_fetch("api", "kernels", method="POST", body=json.dumps({"name": "bad"})) +@pytest.mark.timeout(TEST_TIMEOUT) async def test_kernel_handler_startup_error_pending( jp_fetch, jp_ws_fetch, jp_cleanup_subprocesses, jp_serverapp, jp_kernelspecs ): @@ -219,6 +227,7 @@ async def test_kernel_handler_startup_error_pending( await jp_ws_fetch("api", "kernels", kid, "channels") +@pytest.mark.timeout(TEST_TIMEOUT) async def test_connection( jp_fetch, jp_ws_fetch, jp_http_port, jp_auth_header, jp_cleanup_subprocesses ): diff --git a/jupyter_server/tests/services/sessions/test_api.py b/jupyter_server/tests/services/sessions/test_api.py index 21b4b25cc2..d039037667 100644 --- a/jupyter_server/tests/services/sessions/test_api.py +++ b/jupyter_server/tests/services/sessions/test_api.py @@ -17,6 +17,9 @@ from jupyter_server.utils import url_path_join +TEST_TIMEOUT = 20 + + j = lambda r: json.loads(r.body.decode()) @@ -197,6 +200,7 @@ def assert_session_equality(actual, expected): assert_kernel_equality(actual["kernel"], expected["kernel"]) +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create(session_client, jp_base_url, jp_cleanup_subprocesses, jp_serverapp): # Make sure no sessions exist. resp = await session_client.list() @@ -241,6 +245,7 @@ async def test_create(session_client, jp_base_url, jp_cleanup_subprocesses, jp_s await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_bad( session_client, jp_base_url, jp_cleanup_subprocesses, jp_serverapp, jp_kernelspecs ): @@ -261,6 +266,7 @@ async def test_create_bad( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_bad_pending( session_client, jp_base_url, jp_ws_fetch, jp_cleanup_subprocesses, jp_serverapp, jp_kernelspecs ): @@ -293,6 +299,7 @@ async def test_create_bad_pending( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_file_session( session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -306,6 +313,7 @@ async def test_create_file_session( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_console_session( session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -320,6 +328,7 @@ async def test_create_console_session( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_deprecated(session_client, jp_cleanup_subprocesses, jp_serverapp): resp = await session_client.create_deprecated("foo/nb1.ipynb") assert resp.code == 201 @@ -332,6 +341,7 @@ async def test_create_deprecated(session_client, jp_cleanup_subprocesses, jp_ser await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_with_kernel_id( session_client, jp_fetch, jp_base_url, jp_cleanup_subprocesses, jp_serverapp ): @@ -363,6 +373,7 @@ async def test_create_with_kernel_id( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_create_with_bad_kernel_id( session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -378,6 +389,7 @@ async def test_create_with_bad_kernel_id( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_delete(session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready): resp = await session_client.create("foo/nb1.ipynb") @@ -399,6 +411,7 @@ async def test_delete(session_client, jp_cleanup_subprocesses, jp_serverapp, ses await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_modify_path(session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready): resp = await session_client.create("foo/nb1.ipynb") newsession = j(resp) @@ -413,6 +426,7 @@ async def test_modify_path(session_client, jp_cleanup_subprocesses, jp_serverapp await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_modify_path_deprecated( session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -429,6 +443,7 @@ async def test_modify_path_deprecated( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_modify_type(session_client, jp_cleanup_subprocesses, jp_serverapp, session_is_ready): resp = await session_client.create("foo/nb1.ipynb") newsession = j(resp) @@ -443,6 +458,7 @@ async def test_modify_type(session_client, jp_cleanup_subprocesses, jp_serverapp await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_modify_kernel_name( session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -470,6 +486,7 @@ async def test_modify_kernel_name( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_modify_kernel_id( session_client, jp_fetch, jp_cleanup_subprocesses, jp_serverapp, session_is_ready ): @@ -504,6 +521,7 @@ async def test_modify_kernel_id( await jp_cleanup_subprocesses() +@pytest.mark.timeout(TEST_TIMEOUT) async def test_restart_kernel( session_client, jp_base_url, jp_fetch, jp_ws_fetch, jp_cleanup_subprocesses, session_is_ready ): From 66865b1fb9349eea3cf4fc4c88600235c001fc1b Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 14:05:36 -0800 Subject: [PATCH 6/8] revert doc-test option --- .github/workflows/python-linux.yml | 4 ++-- .github/workflows/python-macos.yml | 4 ++-- .github/workflows/python-windows.yml | 2 +- pyproject.toml | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-linux.yml b/.github/workflows/python-linux.yml index d0f8520ec5..2f69cdaccd 100644 --- a/.github/workflows/python-linux.yml +++ b/.github/workflows/python-linux.yml @@ -51,11 +51,11 @@ jobs: - name: Run the tests if: ${{ matrix.python-version != 'pypy-3.7' }} run: | - pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --doctest-modules + pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered - name: Run the tests on pypy if: ${{ matrix.python-version == 'pypy-3.7' }} run: | - pytest -vv jupyter_server --doctest-modules + pytest -vv jupyter_server - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/.github/workflows/python-macos.yml b/.github/workflows/python-macos.yml index 7831d63422..14f24c4318 100644 --- a/.github/workflows/python-macos.yml +++ b/.github/workflows/python-macos.yml @@ -27,11 +27,11 @@ jobs: - name: Run the tests if: ${{ !startsWith( matrix.python-version, 'pypy' ) }} run: | - pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --doctest-modules + pytest -vv jupyter_server --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered - name: Run the tests on pypy if: ${{ startsWith( matrix.python-version, 'pypy' ) }} run: | - pytest -vv jupyter_server --doctest-modules + pytest -vv jupyter_server - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/.github/workflows/python-windows.yml b/.github/workflows/python-windows.yml index fad3236931..a9e1c7c467 100644 --- a/.github/workflows/python-windows.yml +++ b/.github/workflows/python-windows.yml @@ -31,7 +31,7 @@ jobs: # the file descriptions opened by the asyncio IOLoop. # This leads to a nasty, flaky race condition that we haven't # been able to solve. - pytest -vv -s jupyter_server --doctest-modules + pytest -vv -s jupyter_server - name: Install the Python dependencies for the examples run: | cd examples/simple && pip install -e . diff --git a/pyproject.toml b/pyproject.toml index bd172c53cf..12b2e02174 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ factory = "jupyter_packaging.npm_builder" ignore = ["tbump.toml", ".*", "*.yml", "package-lock.json", "bootstrap*", "conftest.py"] [tool.pytest.ini_options] +addopts = "--doctest-modules" testpaths = [ "jupyter_server/" ] From 13f4fae92656fbf8ade6c70ce0e74712ad505fa8 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 14:35:40 -0800 Subject: [PATCH 7/8] try without pushd popd, which seems to be hanging --- .github/workflows/python-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-linux.yml b/.github/workflows/python-linux.yml index 2f69cdaccd..244aa28c2e 100644 --- a/.github/workflows/python-linux.yml +++ b/.github/workflows/python-linux.yml @@ -71,9 +71,9 @@ jobs: python -m venv test_install ./test_install/bin/python -m pip install -U pip ./test_install/bin/python -m pip install ".[test]" - pushd test_install + cd test_install ./bin/pytest --pyargs jupyter_server - popd + cd .. - name: Test the docs run: | cd docs From bb047b40689b579c61cb365a943ae58a02e5bc91 Mon Sep 17 00:00:00 2001 From: Zach Sailer Date: Mon, 24 Jan 2022 14:52:19 -0800 Subject: [PATCH 8/8] no capture on full install workflow --- .github/workflows/python-linux.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-linux.yml b/.github/workflows/python-linux.yml index 244aa28c2e..8d8290d594 100644 --- a/.github/workflows/python-linux.yml +++ b/.github/workflows/python-linux.yml @@ -71,9 +71,9 @@ jobs: python -m venv test_install ./test_install/bin/python -m pip install -U pip ./test_install/bin/python -m pip install ".[test]" - cd test_install - ./bin/pytest --pyargs jupyter_server - cd .. + pushd test_install + ./bin/pytest --pyargs jupyter_server --capture=no + popd - name: Test the docs run: | cd docs