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

More maintenance cleanup #325

Merged
merged 2 commits into from
Nov 19, 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
35 changes: 19 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.7", "3.11"]
include:
- os: windows-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.8"
- os: ubuntu-latest
python-version: "3.10"
- os: macos-latest
python-version: "3.8"
steps:
Expand All @@ -33,12 +35,16 @@ jobs:
- name: Run the tests
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}
run: |
hatch run cov:test || hatch run test:test --lf
- name: Run the tests on pypy and windows
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
run:
hatch run test:test || hatch run test:test --lf
- name: Codecov
hatch run cov:test --cov-fail-under 75 || hatch run test:test --lf
- name: Run the tests on pypy
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: |
hatch run test:nowarn || hatch run test:nowarn --lf
- name: Run the tests on windows
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
hatch run cov:nowarn || hatch run test:nowarn --lf
- name: Code coverage
run: |
pip install codecov
codecov
Expand Down Expand Up @@ -71,9 +77,12 @@ jobs:
python_version: "3.7"
- 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 @@ -84,16 +93,10 @@ jobs:
uses: actions/checkout@v2
- 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 --lf -W default
export PIP_PRE=1
hatch run test:nowarn || hatch run test:nowarn --lf

make_sdist:
name: Make SDist
Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
rev: v0.990
hooks:
- id: mypy
additional_dependencies: [types-requests]
additional_dependencies: [types-requests, traitlets, jupyter_core]
stages: [manual]

- repo: https://github.com/abravalheri/validate-pyproject
Expand Down Expand Up @@ -67,12 +67,7 @@ repos:
["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"]
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.19.1
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
files: ^\.github/workflows/
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]
- id: check-github-workflows
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
project:
default:
target: auto
threshold: 1
patch:
default:
target: 0%
26 changes: 19 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
requires-python = ">=3.7"
dependencies = [
Expand Down Expand Up @@ -70,15 +71,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 nbformat --cov-branch --cov-report term-missing:skip-covered"
[tool.hatch.envs.cov.scripts]
test = "python -m pytest $ARGS --cov-fail-under 75 {args}"
test = "python -m pytest -vv --cov nbformat --cov-branch --cov-report term-missing:skip-covered {args}"
nowarn = "test -W default {args}"

[tool.black]
line_length = 100
Expand All @@ -97,6 +97,20 @@ filterwarnings = [
"module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]

[tool.mypy]
check_untyped_defs = true
disallow_incomplete_defs = true
Expand All @@ -114,9 +128,7 @@ warn_redundant_casts = true
module = [
"fastjsonschema",
"jsonschema",
"jupyter_core.*",
"pysqlite2",
"traitlets.*",
"testpath"
]
ignore_missing_imports = true
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,4 @@ def test_basics(self):

class SQLiteSignatureStoreTests(SignatureStoreTests):
def setUp(self):
self.store = sign.SQLiteSignatureStore(":memory:")
self.store = sign.SQLiteSignatureStore(":memory:") # type:ignore[assignment]