Skip to content

Commit 105824e

Browse files
committed
pytest with coverage
1 parent b7abf16 commit 105824e

File tree

8 files changed

+172
-24
lines changed

8 files changed

+172
-24
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bandit:
7171

7272
pytest:
7373
@echo "==========" "$@" "=========="
74-
poetry run pytest
74+
poetry run pytest --cov=valuefragments
7575
# --pylama
7676

7777
pyroma:

poetry.lock

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

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[project]
66
description = "Testing installation of Package"
77
name = "valuefragments"
8-
version = "0.6.8"
8+
version = "0.6.9"
99
readme = "README.md"
1010
requires-python = ">=3.12,<4.0" #">=3.12,<4.0"
1111
authors = [{ name = "Dr. Bastian Ebeling", email = "bastian.ebeling@web.de" }]
@@ -210,6 +210,7 @@ vermin = ">=1.5"
210210
yapf = ">=0.43"
211211
clang = "^20.1.5"
212212
cython-lint = "^0.16.7"
213+
pytest-cov = "^6.2.1"
213214

214215
[tool.poetry.group.dev.dependencies.pylama]
215216
extras = ["all"]
@@ -302,8 +303,11 @@ addopts = [
302303
"--cache-clear",
303304
"--color=yes",
304305
# "--typeguard-packages=valuefragments",
305-
306+
"--cov=valuefragments",
307+
"--cov-report=term",
308+
"--cov-report=html",
306309
]
310+
required_plugins = ["pytest-cov", "pytest-sugar", "pytest-asyncio"]
307311
#required_plugins = ["typeguard", "pylama"]
308312
[tool.pyrefly]
309313
python_version = "3.12.10"
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
def load_single_core(core_num: int, duration_s: int | float, target_load: float) -> None: ...
1+
def load_single_core(
2+
core_num: int, duration_s: int | float, target_load: float
3+
) -> None: ...
24
def load_all_cores(duration_s: int | float, target_load: float) -> None: ...

src/joblib/externals/loky/process_executor.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ class ProcessPoolExecutor(Executor):
1414
env: Dict,
1515
) -> None: ...
1616
# def shutdown(self, wait: bool = True, kill_workers: bool = False) -> None: ...
17-
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ...
17+
def shutdown(
18+
self, wait: bool = True, *, cancel_futures: bool = False
19+
) -> None: ...

tests/test_helpers.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ def test_int2bin() -> None:
5353
def test_stringtovalidfilename() -> None:
5454
"""Test function for filename validity of strings."""
5555
assert (
56-
stringtovalidfilename("a:/xäü\\?*1__x&%&$§§)§(§/$<>-_,.;:;:)") == "axäü1__x§§)§(§-_,.;;)"
56+
stringtovalidfilename("a:/xäü\\?*1__x&%&$§§)§(§/$<>-_,.;:;:)")
57+
== "axäü1__x§§)§(§-_,.;;)"
5758
)
5859

5960

6061
def test_basic_auth() -> None:
6162
"""Test if basic_auth does what is expected."""
62-
assert basic_auth("Aladdin", "open sesame")[6:] == "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
63+
assert (
64+
basic_auth("Aladdin", "open sesame")[6:]
65+
== "QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
66+
)
6367

6468

6569
def test_hashfile() -> None:
@@ -80,4 +84,6 @@ def test_humanreadable() -> None:
8084

8185

8286
def test_getselectedhreflinks() -> None:
83-
assert "https://status.python.org/" in getselectedhreflinks("https://python.org", "status")
87+
assert "https://status.python.org/" in getselectedhreflinks(
88+
"https://python.org", "status"
89+
)

tests/test_run_grouped.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@
1313

1414
from valuefragments.helpers import pi_for_cpu_load, run_grouped
1515

16-
tasklist: list[Callable[[], float]] = [partial(pi_for_cpu_load, 10000, 4478) for _ in range(5)]
16+
tasklist: list[Callable[[], float]] = [
17+
partial(pi_for_cpu_load, 10000, 4478) for _ in range(5)
18+
]
1719

1820
@pytest.mark.asyncio
1921
async def test_run_grouped_thread() -> None:
2022
"""Fake main routine for async processing."""
21-
assert abs(sum(await run_grouped(tasklist, "thread"), -15.638000000000002)) <= 0.04
23+
assert (
24+
abs(
25+
sum(await run_grouped(tasklist, "thread"), -15.638000000000002)
26+
)
27+
<= 0.04
28+
)
2229

2330
@pytest.mark.asyncio
2431
async def test_run_grouped_ppe() -> None:
@@ -28,4 +35,7 @@ async def test_run_grouped_ppe() -> None:
2835
@pytest.mark.asyncio
2936
async def test_run_grouped_tpe() -> None:
3037
"""Fake main routine for async processing."""
31-
assert abs(sum(await run_grouped(tasklist, "tpe"), -15.638000000000002)) <= 0.04
38+
assert (
39+
abs(sum(await run_grouped(tasklist, "tpe"), -15.638000000000002))
40+
<= 0.04
41+
)

tests/test_valuetyping.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ def test_pythreeeleven() -> None:
3737

3838
def test_pythreetwelve() -> None:
3939
"""In 3.12 TypeAliasType was introduced but TypeIs not yet."""
40-
from valuefragments.valuetyping import TypeIs, override # TypeAliasType,
40+
from valuefragments.valuetyping import ( # TypeAliasType,
41+
TypeIs,
42+
override,
43+
)
4144

4245
assert TypeIs.__module__ == "typing_extensions"
4346
# assert TypeAliasType.__module__ == "typing"

0 commit comments

Comments
 (0)