Skip to content

Add action that runs backend linting and unit tests - #48

Merged
willbarton merged 3 commits into
mainfrom
actions
Mar 27, 2026
Merged

Add action that runs backend linting and unit tests#48
willbarton merged 3 commits into
mainfrom
actions

Conversation

@willbarton

Copy link
Copy Markdown
Member

This PR adds a GitHub Action that runs our backend linting and unittests and reports test coverage in the action logs on pushes and PRs to main. The linting requires a set of changes to satisfy the linter that are in the last two commits here.

One of them performs automatic fixes by using ruff check --fix. The majority of these are import sorting and spacing fixes. There are a few fixes that remove superfluous "r" arguments to open() and unnecessary class Classname() parentheses. ruff has also converted some format strings to f-strings. It's also collapsed some combined with as blocks

The other is a set of manual fixes I've done. Most of them are line-length related, some are because ruff flags that it's most correct to raise ... from err when inside another exception, and some are to collapse multiple with or if statements.

These will run sequentially as written for now, linting first, then unittests, then coverage.

With these commits together, the actions should pass on this PR.

I would maybe recommend maybe reviewing this PR commit-by-commit, because there's a lot files it touches.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Passes all existing automated tests

@willbarton
willbarton marked this pull request as draft March 25, 2026 14:29
@willbarton
willbarton force-pushed the actions branch 2 times, most recently from 2cb7b23 to c9068e7 Compare March 25, 2026 15:36
@willbarton
willbarton marked this pull request as ready for review March 25, 2026 15:43
@willbarton
willbarton requested a review from schbetsy March 25, 2026 15:43

@schbetsy schbetsy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments, but LGTM regardless.

All of the changes are very reasonable. Too bad the line length rule means adding ~900 lines

Comment thread django/parse_m2/tests/test_data_generator.py
Comment thread django/pyproject.toml Outdated
This adds a GitHub Action that runs our backend linting and unittests and reports test coverage in the action logs on pushes and PRs to `main`.

The linting will require a set of changes to satisfy the linter that will come in a subsequent commit.
This is the result of running `ruff check --fix` to fix linting issues that ruff is able to automatically fix. The majority of these are import sorting and spacing fixes.

There are a few fixes that remove superfluous `"r"` arguments to `open()` and unnecessary `class Classname()` parentheses. ruff has also converted some format strings to f-strings. It's also collapsed some combined `with as` blocks
These are changes I've made manually to satisfy `ruff check`. Most of them are line-length related, some are because ruff flags that it's most correct to `raise ... from err` when inside another exception, and some are to collapse multiple `with` or `if` statements.
@willbarton
willbarton merged commit aea094f into main Mar 27, 2026
3 checks passed
@willbarton
willbarton deleted the actions branch March 27, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants