Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #240 from Aarhus-Psychiatry-Research/martbern/smoo…
Browse files Browse the repository at this point in the history
…ther_devops

Smoother devops
  • Loading branch information
MartinBernstorff authored Oct 10, 2022
2 parents 53131cc + e2528cb commit 833198d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: pre-commit/[email protected]
- uses: pre-commit/[email protected]
with:
extra_args: "--hook-stage manual --all-files"
21 changes: 16 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
default_stages: [commit, push]
default_stages: [push, manual]
default_install_hook_types: [pre-push, pre-commit] # Using the "manual" stage for github actions

repos:
- repo: https://github.com/PyCQA/autoflake
Expand All @@ -12,7 +13,7 @@ repos:
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black", "--filter-files", "--skip __init__.py"]
args: ["--profile", "black"]

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.3
Expand Down Expand Up @@ -56,7 +57,7 @@ repos:
entry: check-yaml
language: python
types: [yaml]

- repo: https://github.com/pycqa/pylint
rev: v2.15.2
hooks:
Expand All @@ -67,5 +68,15 @@ repos:
"-rn", # Only display messages
"-sn", # Don't display the score
"--disable=R,import-error" # Refactors are not important enough to block a commit.
# Unused-imports aren't testable by the github action, so don't test that here.
]
# Unused-imports aren't testable by the github action without installing the whole project, so don't test that here.
]

- repo: local
hooks:
- id: pytest
name: Run integration tests before push
entry: .venv/bin/pytest -m pre_push_test
language: script
stages: [push]
pass_filenames: false
always_run: true
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ good-names = "df,p,f,d,e,n,k,i,v,y_,X,y"
disable = "too-many-lines,line-too-long,missing-raises-doc,no-self-argument,unused-wildcard-import,wildcard-import,no-else-return,too-many-arguments,redefined-outer-name,c-extension-no-member,wrong-import-order,import-outside-toplevel"
extension-pkg-allow-list = "wandb"

[tool.pytest.ini_options]
markers = [
"pre_push_test: Tests run on push. Should be as minimal as possible to maintain fast push speeds.",
]

[tool.isort]
known_third_party = ["wandb"]

Expand Down
6 changes: 0 additions & 6 deletions src/psycopt2d/about.py

This file was deleted.

14 changes: 14 additions & 0 deletions tests/test_train_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ def test_main(model_name):
main(cfg)


@pytest.mark.pre_push_test
def test_integration_test():
"""test main using the logistic model.
Used for quickly testing functions before a push.
"""
with initialize(version_base=None, config_path="../src/psycopt2d/config/"):
cfg = compose(
config_name="integration_testing.yaml",
overrides=["+model=logistic-regression"],
)
main(cfg)


def test_crossvalidation():
"""Test crossvalidation."""
with initialize(version_base=None, config_path="../src/psycopt2d/config/"):
Expand Down

0 comments on commit 833198d

Please sign in to comment.