Skip to content

Commit

Permalink
add pre-commit checks to ci tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Feb 23, 2024
1 parent 81ab612 commit 88637d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 37 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ jobs:
python-version: 3.11

- name: install requirements
run: python -m pip install nox
run: python -m pip install nox pre-commit

- name: run pre-commit
if: ${{ matrix.os == 'ubuntu-latest' }}
run: pre-commit run --all --show-diff-on-failure

- name: run tests
run: nox
36 changes: 0 additions & 36 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,6 @@
EDITABLE_TESTS = False


@nox.session
def format(session):
"""
Autoformat source files.
If argument check is given, only reports changes.
"""
session.install("-e", ".[format]")
check = "check" in session.posargs

autoflake_args = [
"--in-place",
"--imports=fillname",
"--ignore-init-module-imports",
"--remove-unused-variables",
"-r",
"src",
"tests",
]
if check:
autoflake_args.remove("--in-place")
session.run("autoflake", *autoflake_args)

isort_args = ["--profile", "black", "src", "tests"]
if check:
isort_args.insert(0, "--check")
isort_args.insert(1, "--diff")
session.run("isort", *isort_args)

black_args = ["src", "tests"]
if check:
black_args.insert(0, "--check")
black_args.insert(1, "--diff")
session.run("black", *black_args)


@nox.session
def doc(session):
"""
Expand Down

0 comments on commit 88637d8

Please sign in to comment.