Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pytest opts and pre-commit #889

Merged
merged 5 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 112 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ defaults:
shell: bash

jobs:
# Run "pre-commit run --all-files"
pre-commit:
runs-on: ubuntu-20.04
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

# ref: https://github.com/pre-commit/action
- uses: pre-commit/[email protected]
- name: Help message if pre-commit fail
if: ${{ failure() }}
run: |
echo "You can install pre-commit hooks to automatically run formatting"
echo "on each commit with:"
echo " pre-commit install"
echo "or you can run by hand on staged files with"
echo " pre-commit run"
echo "or after-the-fact on already committed files with"
echo " pre-commit run --all-files"

build:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -29,114 +53,114 @@ jobs:
- os: macos-latest
python-version: "3.8"
steps:
- name: Checkout
uses: actions/checkout@v2

- 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: |
cmd="python -m pytest -vv -raXs --cov ipykernel --cov-branch --cov-report term-missing:skip-covered --durations 10 --color=yes"
$cmd || $cmd --lf

- name: Run the tests on pypy and windows
timeout-minutes: 15
if: ${{ startsWith( matrix.python-version, 'pypy' ) || startsWith(matrix.os, 'windows') }}
run: |
cmd="python -m pytest -vv -raXs --durations 10 --color=yes"
$cmd || $cmd --lf

- name: Coverage
run: |
codecov
- name: Checkout
uses: actions/checkout@v2

- 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: |
cmd="python -m pytest -vv --cov ipykernel --cov-branch --cov-report term-missing:skip-covered"
$cmd || $cmd --lf

- name: Run the tests on pypy and windows
timeout-minutes: 15
if: ${{ startsWith( matrix.python-version, 'pypy' ) || startsWith(matrix.os, 'windows') }}
run: |
cmd="python -m pytest -vv"
$cmd || $cmd --lf

- name: Coverage
run: |
codecov

test_docs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [ '3.9' ]
python-version: ["3.9"]
exclude:
- os: windows-latest
python-version: pypy-3.7
- os: windows-latest
python-version: pypy-3.7
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Build the docs
run: |
cd docs
pip install -r requirements.txt
make html SPHINXOPTS="-W"
- name: Build the docs
run: |
cd docs
pip install -r requirements.txt
make html SPHINXOPTS="-W"

- name: Install the Python dependencies
run: |
pip install .
pip install velin
- name: Install the Python dependencies
run: |
pip install .
pip install velin

- name: Check Docstrings
run: |
velin . --check --compact
- name: Check Docstrings
run: |
velin . --check --compact

test_without_debugpy:
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: [ '3.9' ]
os: [ubuntu-latest]
python-version: ["3.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install the Python dependencies without debugpy
run: |
pip install .[test]
pip uninstall --yes debugpy
- name: Install the Python dependencies without debugpy
run: |
pip install .[test]
pip uninstall --yes debugpy

- name: List installed packages
run: |
pip freeze
- name: List installed packages
run: |
pip freeze

- name: Run the tests
timeout-minutes: 10
run: |
cmd="python -m pytest -vv -raXxs --durations 10 --color=yes"
$cmd || $cmd --lf
- name: Run the tests
timeout-minutes: 10
run: |
cmd="python -m pytest -vv -raXxs"
$cmd || $cmd --lf

test_miniumum_versions:
name: Test Minimum Versions
Expand All @@ -152,7 +176,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- name: Run the unit tests
run: |
cmd="python -m pytest -vv -raXxs --durations 10 --color=yes"
cmd="python -m pytest -vv -raXxs"
$cmd || $cmd --lf

test_prereleases:
Expand All @@ -173,7 +197,7 @@ jobs:
pip check
- name: Run the tests
run: |
cmd="python -m pytest -vv -raXs --durations 10 --color=yes"
cmd="python -m pytest -vv"
$cmd || $cmd --lf

make_sdist:
Expand Down Expand Up @@ -214,5 +238,5 @@ jobs:
- name: Run Test
run: |
cd sdist/test
cmd="python -m pytest -vv -raXs --durations 10 --color=yes"
cmd="python -m pytest -vv"
$cmd || $cmd --lf
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: ipyparallel
package_spec: "-e \".[test]\""
package_spec: '-e ".[test]"'

jupyter_kernel_test:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ David Hirschfeld <[email protected]> dhirschfeld <david.hirschfeld
David P. Sanders <[email protected]> David P. Sanders <[email protected]>
David Warde-Farley <[email protected]> David Warde-Farley <>
Doug Blank <[email protected]> Doug Blank <[email protected]>
Eugene Van den Bulke <[email protected]> Eugene Van den Bulke <[email protected]>
Eugene Van den Bulke <[email protected]> Eugene Van den Bulke <[email protected]>
Evan Patterson <[email protected]> <[email protected]>
Evan Patterson <[email protected]> <[email protected]>
Evan Patterson <[email protected]> <[email protected]>
Expand Down
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-toml
- id: check-yaml
- id: debug-statements
exclude: ipykernel/kernelapp.py
- id: forbid-new-submodules
- id: check-builtin-literals
- id: trailing-whitespace

# - repo: https://github.com/psf/black
# rev: 22.1.0
# hooks:
# - id: black
# args: ["--line-length", "100"]

# - repo: https://github.com/PyCQA/isort
# rev: 5.10.1
# hooks:
# - id: isort
# files: \.py$
# args: [--profile=black]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
hooks:
- id: prettier

# - repo: https://github.com/pycqa/flake8
# rev: 4.0.1
# hooks:
# - id: flake8
# additional_dependencies:
# [
# "flake8-bugbear==20.1.4",
# "flake8-logging-format==0.6.0",
# "flake8-implicit-str-concat==0.2.0",
# ]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.8.0
hooks:
- id: eslint

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.10.2
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
Loading