Skip to content

Commit f6aab1a

Browse files
authored
Fix existing tests, add new, make coverage reports and mutation testing (#118)
* fix: naming issues in pipelines and tests * fix: naming issues in pipelines and tests * chore: move some tests to correct dir * fix: doc map test * fix: test for gh2bt map * test: maps for both sides * chore: add inits where needed * fix: handler tests * fix: gh ingestor tests * fix: upd gh provider tests * fix: handler arg validation tests * test: add pmc tests and make pmc safer * test: spdx ingestor * test: policy for gh to bt * test: upd license * test: shared version, fix regex * fix: version test * test: add more test cases for mapping version * fix: fix map test bt to gh * fix: expand bt dummy * fix: doc map * fix: revert * chore: cleanup * test: topics map * test: make coverage report * test: configure cosmic-rays * chore: upd cosmic-ray setup * chore: remove unncecessary installs from ci * test: badges util * test: cleaning utils + pydantic warnings * test: comparisons utils * test: conversions utils * test: files utils * test: templating utils * test: shared publications * test: biotools id map * test: name map * test: upd biotools * test: map language * test: homepage map * test: maturity map + homepage fix * test: publication map * test: description map * test: policy over * test: policy on top * test: description * test: homepage * test: name map * test: license map * test: upd topics map * test: version map * test: readme map + actual func * test: citation map * chore: rename map tests * test: map main gh2bt * test: map main bt2gh * test: fix mismatch in map tests * fix: test files utils * test: none prop protocol * test: map protocol * test: gh transformer + actual bug * test: bt transformer * test: pmc transformer * test: spdx transformer * test: spdx composer * test: gh composer * test: pmc composer * test: biotools composer * chore: separated black config * chore: separated ruff config * chore: separated pytest config * chore: separated coverage config * chore: cleanup * chore: narrowed coverage report * chore: update cr config * chore: tighten checks further * fix: correct python version in ci * fix: patch tokens in tests * fix: patch tokens in tests correctly
1 parent 559b791 commit f6aab1a

File tree

95 files changed

+8159
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+8159
-644
lines changed

.coveragerc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[run]
2+
source = bridge
3+
branch = True
4+
parallel = True
5+
6+
[report]
7+
skip_covered = False
8+
show_missing = True
9+
omit =
10+
*/tests/*
11+
*/__init__.py
12+
*/core/*
13+
*/bridge/config.py
14+
*/bridge/logging.py
15+
exclude_lines =
16+
pragma: no cover
17+
if TYPE_CHECKING:
18+
raise NotImplementedError
19+
@abstractmethod
20+
def __repr__
21+
def __str__
22+
if __name__ == .__main__.:
23+
if logger\.isEnabledFor
24+
^\s*\.\.\.\s*$

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
uses: actions/checkout@v4
1212

1313
- name: Setup Python
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
16-
python-version: '3.11'
16+
python-version: '3.12'
1717

1818
- name: Cache pip and poetry
1919
uses: actions/cache@v4
@@ -30,7 +30,7 @@ jobs:
3030
python -m pip install --upgrade pip
3131
pip install poetry
3232
poetry config virtualenvs.create false --local
33-
poetry install --no-interaction --no-ansi
33+
poetry install --no-interaction --no-ansi --with docs
3434
3535
- name: Run unit tests
3636
env:

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ __pycache__/
3131

3232
# VSCode
3333
.vscode
34+
35+
# Tests
36+
.coverage
37+
htmlcov/
38+
cosmic-ray.sqlite
39+
cosmic-ray-report.html

black.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[tool.black]
2+
line-length = 120
3+
target-version = ["py312"]
4+
force-exclude = '''
5+
(
6+
(^|/)src/bridge/core/biotools\\.py
7+
| (^|/)src/bridge/core/github_repo\\.py
8+
| (^|/)src/bridge/core/github_latest_release\\.py
9+
| (^|/)src/bridge/core/github_languages\\.py
10+
| (^|/)src/bridge/core/license\\.py
11+
| (^|/)docs/
12+
| (^|/)tests/
13+
)
14+
"""
15+
'''

cosmic-ray.ci.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[cosmic-ray]
2+
module-path = "src"
3+
timeout = 45
4+
test-command = "python -m pytest -q"
5+
excluded-modules = [
6+
"bridge.core",
7+
"bridge.logging",
8+
"bridge.config",
9+
]
10+
11+
[[cosmic-ray.targets]]
12+
module = "bridge"
13+
14+
[cosmic-ray.distributor]
15+
name = "local"

cosmic-ray.local.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[cosmic-ray]
2+
module-path = "src"
3+
timeout = 45
4+
test-command = "python -m pytest -q"
5+
excluded-modules = [
6+
"bridge.core",
7+
"bridge.logging",
8+
"bridge.config",
9+
]
10+
11+
[[cosmic-ray.targets]]
12+
module = "bridge"
13+
14+
[cosmic-ray.distributor]
15+
name = "local"
16+
17+
# [cosmic-ray.distributor]
18+
# name = "http"
19+
20+
# [cosmic-ray.distributor.http]
21+
# worker-urls = [
22+
# "http://localhost:9876",
23+
# "http://localhost:9877",
24+
# "http://localhost:9878",
25+
# "http://localhost:9879",
26+
# "http://localhost:9880",
27+
# "http://localhost:9881",
28+
# "http://localhost:9882",
29+
# ]

poetry.lock

Lines changed: 1237 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pre-commit = "^4.3.0"
3333
pytest = "^8.4.2"
3434
pytest-asyncio = "^1.2.0"
3535
pytest-httpx = "^0.35.0"
36+
pytest-cov = "^7.0.0"
37+
cosmic-ray = "^8.4.3"
3638

3739
[tool.poetry.group.docs.dependencies]
3840
sphinx = "^8.2.3"
@@ -46,63 +48,14 @@ grimp = "^3.12"
4648
requires = ["poetry-core>=2.0.0,<3.0.0"]
4749
build-backend = "poetry.core.masonry.api"
4850

49-
[tool.black]
50-
line-length = 120
51-
target-version = ["py312"]
52-
force-exclude = '''
53-
(
54-
(^|/)src/bridge/core/biotools\\.py
55-
| (^|/)src/bridge/core/github_repo\\.py
56-
| (^|/)src/bridge/core/github_latest_release\\.py
57-
| (^|/)src/bridge/core/github_languages\\.py
58-
| (^|/)src/bridge/core/license\\.py
59-
| (^|/)docs/
60-
)
61-
"""
62-
'''
63-
64-
[tool.ruff]
65-
target-version = "py312"
66-
line-length = 120
67-
extend-exclude = [
68-
"docs",
69-
"src/bridge/core/biotools.py",
70-
"src/bridge/core/github_repo.py",
71-
"src/bridge/core/github_latest_release.py",
72-
"src/bridge/core/github_languages.py",
73-
"src/bridge/core/license.py",
74-
]
75-
76-
[tool.ruff.lint]
77-
select = ["F", "E", "W", "I", "B", "C4", "UP", "N", "D"]
78-
ignore = [
79-
"D105", # magic methods
80-
"D107", # __init__
81-
"D200", # one-line docstring must be single line
82-
"D205", # blank line after summary
83-
"D400", # first line ends with period
84-
]
85-
per-file-ignores = { "**/__init__.py" = ["F401"] }
86-
87-
[tool.ruff.lint.isort]
88-
known-first-party = ["bridge"]
89-
combine-as-imports = true
90-
91-
[tool.ruff.lint.pydocstyle]
92-
convention = "numpy"
93-
94-
[tool.pytest.ini_options]
95-
asyncio_mode = "auto"
96-
testpaths = [
97-
"tests",
98-
]
99-
10051
[tool.poetry]
10152
packages = [{ include = "bridge", from = "src" }]
10253

10354
[tool.poetry.scripts]
10455
lint = "scripts.quality:lint"
10556
fmt = "scripts.quality:fmt"
57+
coverage-report = "scripts.quality:coverage_report"
58+
cosmic-ray-report = "scripts.quality:cosmic_ray_report"
10659
gen-biotools-models = "scripts.gen_models:generate_biotools_models"
10760
gen-github-models = "scripts.gen_models:generate_github_models"
10861
gen-docs = "scripts.gen_docs:main"

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
asyncio_mode = auto
3+
testpaths =
4+
tests

ruff.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
target-version = "py312"
2+
line-length = 120
3+
extend-exclude = [
4+
"docs",
5+
"tests",
6+
"src/bridge/core/biotools.py",
7+
"src/bridge/core/github_repo.py",
8+
"src/bridge/core/github_latest_release.py",
9+
"src/bridge/core/github_languages.py",
10+
"src/bridge/core/license.py",
11+
]
12+
13+
[lint]
14+
select = ["F", "E", "W", "I", "B", "C4", "UP", "N", "D"]
15+
ignore = [
16+
"D105", # magic methods
17+
"D107", # __init__
18+
"D200", # one-line docstring must be single line
19+
"D205", # blank line after summary
20+
"D400", # first line ends with period
21+
]
22+
per-file-ignores = { "**/__init__.py" = ["F401"] }
23+
24+
[lint.isort]
25+
known-first-party = ["bridge"]
26+
combine-as-imports = true
27+
28+
[lint.pydocstyle]
29+
convention = "numpy"

0 commit comments

Comments
 (0)