Skip to content

Commit a94fe35

Browse files
authored
Fix CI (#16)
1 parent be7dc17 commit a94fe35

File tree

9 files changed

+107
-153
lines changed

9 files changed

+107
-153
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 76 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python package
5-
1+
name: Tests
62
on:
73
push:
4+
branches: ["main"]
85
pull_request:
96
schedule:
107
- cron: "0 8 * * *"
118

12-
concurrency:
13-
group: >-
14-
${{ github.workflow }}-
15-
${{ github.ref_type }}-
16-
${{ github.event.pull_request.number || github.sha }}
17-
cancel-in-progress: true
9+
defaults:
10+
run:
11+
shell: bash -eux {0}
1812

1913
jobs:
2014
build:
@@ -23,62 +17,56 @@ jobs:
2317
fail-fast: false
2418
matrix:
2519
os: [ubuntu-latest, windows-latest, macos-latest]
26-
python-version: ["3.7", "3.10"]
20+
python-version: ["3.8", "3.11"]
2721
include:
2822
- os: windows-latest
2923
python-version: "3.9"
3024
- os: ubuntu-latest
3125
python-version: "pypy-3.8"
3226
- os: macos-latest
33-
python-version: "3.8"
27+
python-version: "3.10"
3428
steps:
3529
- uses: actions/checkout@v2
3630
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
37-
- name: Install dependencies
38-
run: |
39-
pip install -e ".[test]"
40-
- name: Test with pytest
41-
run: |
42-
python -m pytest -vv --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered
43-
- name: Check CLI
31+
- name: Run the tests
32+
run: hatch run cov:test || hatch run test:test --lf
33+
- name: Coverage
4434
run: |
45-
cd $HOME
46-
jupyter troubleshoot
35+
pip install codecov coverage[toml]
36+
codecov
4737
48-
test_miniumum_versions:
38+
test_docs:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v3
42+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
43+
- run: hatch run docs:build
44+
45+
test_minimum_versions:
4946
name: Test Minimum Versions
47+
timeout-minutes: 20
5048
runs-on: ubuntu-latest
51-
timeout-minutes: 10
5249
steps:
53-
- uses: actions/checkout@v2
54-
- name: Base Setup
55-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
50+
- uses: actions/checkout@v3
51+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
5652
with:
57-
python_version: "3.7"
58-
- name: Install miniumum versions
59-
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
53+
dependency_type: minimum
6054
- name: Run the unit tests
61-
run: pytest -vv -W default || pytest -vv -W default --lf
55+
run: |
56+
hatch run test:nowarn || hatch run test:nowarn --lf
6257
6358
test_prereleases:
6459
name: Test Prereleases
65-
timeout-minutes: 10
6660
runs-on: ubuntu-latest
61+
timeout-minutes: 20
6762
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v2
70-
- name: Base Setup
71-
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
72-
- name: Install the Python dependencies
73-
run: |
74-
pip install --upgrade --upgrade-strategy eager --pre -e ".[test]"
75-
- name: List installed packages
76-
run: |
77-
pip freeze
78-
pip check
63+
- uses: actions/checkout@v3
64+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
65+
with:
66+
dependency_type: pre
7967
- name: Run the tests
8068
run: |
81-
pytest -vv || pytest -vv --lf
69+
hatch run test:nowarn || hatch run test:nowarn --lf
8270
8371
make_sdist:
8472
name: Make SDist
@@ -98,22 +86,52 @@ jobs:
9886
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
9987
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
10088

101-
pre-commit:
89+
pre_commit:
10290
name: pre-commit
10391
runs-on: ubuntu-latest
10492
steps:
10593
- uses: actions/checkout@v2
106-
- uses: actions/setup-python@v2
107-
- uses: pre-commit/[email protected]
108-
with:
109-
extra_args: --all-files --hook-stage=manual
110-
- name: Help message if pre-commit fail
111-
if: ${{ failure() }}
94+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
95+
- uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1
96+
97+
check_release:
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v3
102+
- name: Base Setup
103+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
104+
- name: Install Dependencies
112105
run: |
113-
echo "You can install pre-commit hooks to automatically run formatting"
114-
echo "on each commit with:"
115-
echo " pre-commit install"
116-
echo "or you can run by hand on staged files with"
117-
echo " pre-commit run"
118-
echo "or after-the-fact on already committed files with"
119-
echo " pre-commit run --all-files --hook-stage=manual"
106+
pip install -e .
107+
- name: Check Release
108+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
109+
with:
110+
token: ${{ secrets.GITHUB_TOKEN }}
111+
112+
check_links:
113+
name: Check Links
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 15
116+
steps:
117+
- uses: actions/checkout@v3
118+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
119+
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
120+
121+
tests_check: # This job does nothing and is only used for the branch protection
122+
if: always()
123+
needs:
124+
- build
125+
- pre_commit
126+
- test_docs
127+
- test_minimum_versions
128+
- test_prereleases
129+
- check_links
130+
- check_release
131+
- test_sdist
132+
runs-on: ubuntu-latest
133+
steps:
134+
- name: Decide whether the needed jobs succeeded or failed
135+
uses: re-actors/alls-green@release/v1
136+
with:
137+
jobs: ${{ toJSON(needs) }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changes in Pytest-Jupyter
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
# Add any paths that contain custom static files (such as style sheets) here,
5757
# relative to this directory. They are copied after the builtin static files,
5858
# so a file named "default.css" will overwrite the builtin "default.css".
59-
html_static_path = ["_static"]
59+
# html_static_path = ["_static"]

pyproject.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,27 @@ classifiers = [
2424
]
2525
dependencies = [
2626
"pytest",
27+
"pytest-asyncio",
28+
"jupyter_core"
2729
]
30+
requires-python = ">=3.8"
31+
2832

2933
[project.optional-dependencies]
30-
core = [
31-
"jupyter_core",
32-
]
3334
docs = [
3435
"myst_parser",
3536
"pydata_sphinx_theme",
3637
"Sphinx",
3738
]
39+
client = [
40+
"jupyter_client"
41+
]
3842
server = [
39-
"jupyter_core",
4043
"jupyter_server",
4144
"nbformat",
42-
"pytest-tornasync",
45+
]
46+
test = [
47+
"pytest-timeout"
4348
]
4449

4550
[project.urls]
@@ -51,6 +56,7 @@ path = "pytest_jupyter/_version.py"
5156
[tool.hatch.build.targets.sdist]
5257
include = [
5358
"/pytest_jupyter",
59+
"/tests",
5460
]
5561

5662
[tool.hatch.envs.docs]

pytest_jupyter/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
3+
4+
from .jupyter_core import * # noqa

pytest_jupyter/jupyter_core.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,9 @@
33
import os
44
import sys
55

6+
import jupyter_core
67
import pytest
78

8-
# The try block is needed so that the documentation can
9-
# still build without needed to install all the dependencies.
10-
try:
11-
import jupyter_core.paths
12-
13-
except ImportError:
14-
import warnings
15-
16-
warnings.warn(
17-
"The jupyter_core plugin has not been installed. "
18-
"If you're trying to use this plugin and you've installed "
19-
"`pytest-jupyter`, there is likely one more step "
20-
"you need. Try: `pip install 'pytest-jupyter[core]'`"
21-
)
22-
23-
249
from .utils import mkdir
2510

2611

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os
2+
3+
os.environ["JUPYTER_PLATFORM_DIRS"] = "1"
4+
pytest_plugins = ["pytest_jupyter"]

tests/test_jupyter_core.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
from jupyter_core import paths
4+
5+
6+
def test_environ(jp_environ):
7+
assert os.path.exists(paths.jupyter_data_dir())

0 commit comments

Comments
 (0)