Skip to content

Commit

Permalink
chore: use pytest instead of unittest / tooling / formatting (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum authored Apr 17, 2024
1 parent c109bf0 commit ee449e8
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: poetry install

- name: Formatting with ruff
run: poetry run ruff format .
run: poetry run ruff format --check .

- name: Linting with ruff
run: poetry run ruff check .
Expand All @@ -38,6 +38,6 @@ jobs:
run: poetry run mypy .

- name: unittests
run: poetry run python -m unittest discover tests
run: poetry run pytest -s tests


1 change: 0 additions & 1 deletion dsp_permissions_scripts/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Group(BaseModel):

model_config = ConfigDict(frozen=True)

val: str
Expand Down
70 changes: 69 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ types-requests = "^2.31.0.20240406"
python-dotenv = "^1.0.1"
ruff = "^0.3.7"
pre-commit = "^3.7.0"
pytest = "^8.1.1"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down Expand Up @@ -52,6 +53,14 @@ select = [
"B023", # flake8-bugbear: function-uses-loop-variable
"FIX", # flake8-fixme: checks for FIXME, TODO, XXX, etc.
]
ignore = [
"ISC001", # flake8-implicit-str-concat: single-line-implicit-string-concatenation # incompatible with the formatter
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # flake8-bandit: use of assert
]

[tool.ruff.lint.pydocstyle]
convention = "google"
Expand Down
1 change: 1 addition & 0 deletions tests/test_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# ruff: noqa: PT009 (pytest-unittest-assertion) (remove this line when pytest is used instead of unittest)
# ruff: noqa: PT027 (pytest-unittest-raises-assertion) (remove this line when pytest is used instead of unittest)


class TestAp(unittest.TestCase):
ap = Ap(
forGroup=group.UNKNOWN_USER,
Expand Down
1 change: 1 addition & 0 deletions tests/test_ap_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# ruff: noqa: PT009 (pytest-unittest-assertion) (remove this line when pytest is used instead of unittest)


class TestApSerialization(unittest.TestCase):
shortcode = "1234"
project_iri = "http://rdfh.ch/projects/MsOaiQkcQ7-QPxsYBKckfQ"
Expand Down
1 change: 1 addition & 0 deletions tests/test_doap_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# ruff: noqa: PT009 (pytest-unittest-assertion) (remove this line when pytest is used instead of unittest)


class TestDoapSerialization(unittest.TestCase):
shortcode = "1234"

Expand Down
1 change: 1 addition & 0 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# ruff: noqa: PT009 (pytest-unittest-assertion) (remove this line when pytest is used instead of unittest)


class TestHelpers(unittest.TestCase):
def test_sort_groups(self) -> None:
groups_original = [
Expand Down

0 comments on commit ee449e8

Please sign in to comment.