Skip to content

Commit

Permalink
Add test infrastructure
Browse files Browse the repository at this point in the history
- Add pytest configuration with verbose output
- Add mypy configuration with strict type checking
- Add coverage configuration and reporting
- Add development dependencies in requirements.txt
- Update CI workflow to run tests, type checks and coverage
- Update gitignore for test artifacts

Co-Authored-By: K. Yanagisawa <[email protected]>
  • Loading branch information
1 parent 0c64c50 commit b3ef76a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[run]
source = script
omit =
script/test_*.py
script/**/test_*.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise NotImplementedError
if __name__ == .__main__.:
pass
raise ImportError
6 changes: 5 additions & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ jobs:
options: -v ${{ github.workspace }}:/work
run: |
cd /work
python -m pytest .
pip install mypy coverage
python -m pytest .
python -m mypy script/
coverage run -m pytest
coverage report -m
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ dmypy.json
**~
\#**

**test**
**/test_data/**
**/test_output/**
.coverage
htmlcov/
**rmsd.dat
**.out
**.err
**.err
36 changes: 36 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[mypy]
python_version = 3.12
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
disallow_untyped_decorators = True
no_implicit_optional = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_no_return = True
warn_unreachable = True
strict_optional = True
ignore_missing_imports = True

[mypy.plugins.numpy.*]
ignore_missing_imports = True

[mypy-gridData.*]
ignore_missing_imports = True

[mypy-Bio.*]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-jinja2.*]
ignore_missing_imports = True

[mypy-tqdm.*]
ignore_missing_imports = True

[mypy-yaml.*]
ignore_missing_imports = True
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
python_files = test_*.py
python_functions = test_*
addopts = --maxfail=1 --disable-warnings -v
testpaths = script
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pytest>=7.0.0
coverage>=7.0.0
mypy>=1.0.0
numpy>=1.24.0
gridData>=1.0.0
scipy>=1.10.0
Bio>=1.0.0
jinja2>=3.0.0
tqdm>=4.65.0
pyyaml>=6.0.0

0 comments on commit b3ef76a

Please sign in to comment.