diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index 0007b252d3..dbef7cde58 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -9,6 +9,7 @@ on: jobs: tests: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout @@ -22,11 +23,14 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install ".[test]" + pip install "." pip install --pre --upgrade jupyterlab_server[test] jupyterlab[test] nbclassic[test] pip freeze - name: Run tests + working-directory: ../ run: | + # NOTE: tests won't pass from inside the working copy because of + # conftest.py:pytest_plugins (must be at the top level) pytest --pyargs jupyterlab_server python -m jupyterlab.browser_check --no-browser-test diff --git a/conftest.py b/conftest.py index 4a3b569856..bdac3802bc 100644 --- a/conftest.py +++ b/conftest.py @@ -1,31 +1,3 @@ -import pytest - pytest_plugins = [ "jupyter_server.pytest_plugin" ] - -def pytest_addoption(parser): - parser.addoption( - "--integration_tests", - default=False, - type=bool, - help="only run tests with the 'integration_test' pytest mark.", - ) - - -def pytest_configure(config): - # register an additional marker - config.addinivalue_line( - "markers", "integration_test" - ) - - -def pytest_runtest_setup(item): - is_integration_test = any([mark for mark in item.iter_markers(name="integration_test")]) - - if item.config.getoption("--integration_tests") is True: - if not is_integration_test: - pytest.skip("Only running tests marked as 'integration_test'.") - else: - if is_integration_test: - pytest.skip("Skipping this test because it's marked 'integration_test'. Run integration tests using the `--integration_tests` flag.") diff --git a/jupyter_server/tests/conftest.py b/jupyter_server/tests/conftest.py new file mode 100644 index 0000000000..cb373c80c4 --- /dev/null +++ b/jupyter_server/tests/conftest.py @@ -0,0 +1,27 @@ +import pytest + +def pytest_addoption(parser): + parser.addoption( + "--integration_tests", + default=False, + type=bool, + help="only run tests with the 'integration_test' pytest mark.", + ) + + +def pytest_configure(config): + # register an additional marker + config.addinivalue_line( + "markers", "integration_test" + ) + + +def pytest_runtest_setup(item): + is_integration_test = any([mark for mark in item.iter_markers(name="integration_test")]) + + if item.config.getoption("--integration_tests") is True: + if not is_integration_test: + pytest.skip("Only running tests marked as 'integration_test'.") + else: + if is_integration_test: + pytest.skip("Skipping this test because it's marked 'integration_test'. Run integration tests using the `--integration_tests` flag.")