Skip to content

Commit

Permalink
Add windows coverage and clean up workflows (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Nov 18, 2022
1 parent dbea8f2 commit c5ce7bf
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 63 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/check-release.yml

This file was deleted.

67 changes: 28 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,23 @@ jobs:
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install the Python dependencies
run: |
pip install .[test] codecov
- name: Install matplotlib
if: ${{ !startsWith(matrix.os, 'macos') && !startsWith(matrix.python-version, 'pypy') }}
run: |
pip install matplotlib || echo 'failed to install matplotlib'
- name: Install alternate event loops
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
pip install curio || echo 'ignoring curio install failure'
pip install trio || echo 'ignoring trio install failure'
- name: List installed packages
run: |
pip uninstall pipx -y
pip install pipdeptree
pipdeptree
pipdeptree --reverse
pip freeze
pip check
- name: Run the tests
timeout-minutes: 15
if: ${{ !startsWith( matrix.python-version, 'pypy' ) && !startsWith(matrix.os, 'windows') }}
run: |
hatch run cov:test || hatch run test:test --lf
hatch run cov:test --cov-fail-under 50 || hatch run test:test --lf
- name: Run the tests on pypy
timeout-minutes: 15
if: ${{ startsWith( matrix.python-version, 'pypy' ) }}
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
- name: Run the tests on pypy and windows
- name: Run the tests on Windows
timeout-minutes: 15
if: ${{ startsWith( matrix.python-version, 'pypy' ) || startsWith(matrix.os, 'windows') }}
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
pip install -e ".[test]"
pytest -vv || pytest -vv --lf
hatch run cov:nowarn || hatch run test:nowarn --lf
- name: Coverage
run: |
Expand All @@ -81,6 +62,7 @@ jobs:
- name: Check Launcher
run: |
pip install .
cd $HOME
python -m ipykernel_launcher --help
Expand All @@ -91,6 +73,15 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1

check_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

test_docs:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -123,7 +114,7 @@ jobs:
- name: Run the tests
timeout-minutes: 10
run: hatch run test:test
run: pytest -W default -vv || pytest --vv -W default --lf

test_miniumum_versions:
name: Test Minimum Versions
Expand All @@ -137,9 +128,12 @@ jobs:
python_version: "3.8"
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
with:
only_create_file: 1
- name: Run the unit tests
run: |
pytest -vv -W default || pytest -vv -W default --lf
export PIP_CONSTRAINT="./contraints_file.txt"
hatch run test:nowarn || hatch run test:nowarn --lf
test_prereleases:
name: Test Prereleases
Expand All @@ -150,16 +144,10 @@ jobs:
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
pip install --pre -e ".[test]"
- name: List installed packages
run: |
pip freeze
pip check
- name: Run the tests
run: |
pytest -vv -W default || pytest -vv -W default --lf
export PIP_PRE=1
hatch run test:nowarn || hatch run test:nowarn --lf
make_sdist:
name: Make SDist
Expand Down Expand Up @@ -195,6 +183,7 @@ jobs:
- test_miniumum_versions
- pre_commit
- test_prereleases
- check_release
- link_check
- test_sdist
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions ipykernel/tests/test_embed_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from contextlib import contextmanager
from subprocess import PIPE, Popen

import pytest
from flaky import flaky
from jupyter_client import BlockingKernelClient
from jupyter_core import paths
Expand All @@ -18,6 +19,10 @@
TIMEOUT = 15


if os.name == "nt":
pytest.skip("skipping tests on windows", allow_module_level=True)


@contextmanager
def setup_kernel(cmd):
"""start an embedded kernel in a subprocess, and wait for it to be ready
Expand Down
2 changes: 2 additions & 0 deletions ipykernel/tests/test_eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import asyncio
import os
import sys
import threading
import time

Expand Down Expand Up @@ -54,6 +55,7 @@ def test_asyncio_interrupt():


@windows_skip
@pytest.mark.skipif(sys.platform == "darwin", reason="hangs on macos")
def test_tk_loop(kernel):
def do_thing():
time.sleep(1)
Expand Down
5 changes: 5 additions & 0 deletions ipykernel/tests/test_start_kernel.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import os
from textwrap import dedent

import pytest
from flaky import flaky

from .test_embed_kernel import setup_kernel

TIMEOUT = 15

if os.name == "nt":
pytest.skip("skipping tests on windows", allow_module_level=True)


@flaky(max_runs=3)
def test_ipython_start_kernel_userns():
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@ build = "make -C docs html SPHINXOPTS='-W'"
features = ["test"]
[tool.hatch.envs.test.scripts]
test = "python -m pytest -vv {args}"
nowarn = "python -m pytest -vv -W default {args}"
nowarn = "test -W default {args}"

[tool.hatch.envs.cov]
features = ["test"]
dependencies = ["coverage", "pytest-cov"]
[tool.hatch.envs.cov.env-vars]
ARGS = "-vv --cov ipykernel --cov-branch --cov-report term-missing:skip-covered"
dependencies = ["coverage", "pytest-cov", "matplotlib", "curio", "trio"]
[tool.hatch.envs.cov.scripts]
test = "python -m pytest $ARGS --cov-fail-under 50 {args}"
test = "python -m pytest -vv --cov ipykernel --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"

[tool.mypy]
check_untyped_defs = true
Expand Down

0 comments on commit c5ce7bf

Please sign in to comment.