Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Modules/private/CreateCoverageTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ function(_create_coverage_targets_impl)
${PROJECT_SOURCE_DIR}/test/python/test_phlex.py --cov=${PROJECT_SOURCE_DIR}/test/python
--cov-report=term-missing --cov-report=xml:${CMAKE_BINARY_DIR}/coverage-python.xml
--cov-report=html:${CMAKE_BINARY_DIR}/coverage-python-html
--cov-config=${PROJECT_SOURCE_DIR}/test/python/.coveragerc
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating Python coverage report"
VERBATIM
Expand Down
1 change: 1 addition & 0 deletions ci/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spack:
- ninja
- py-gcovr
- py-pip # Needed temporarily for ruff installation
- py-pytest-cov # Needed for Python coverage reports
- |
llvm@21.1.4: +zstd +llvm_dylib +link_llvm_dylib ~lldb targets=x86

Expand Down
12 changes: 12 additions & 0 deletions test/python/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[run]
# Include non-test Python modules for coverage measurement
source = .
omit =
test_*.py
**/test_*.py

[report]
# Exclude test files from coverage reports
omit =
test_*.py
**/test_*.py
2 changes: 2 additions & 0 deletions test/python/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
__pycache__
.coverage
.pytest_cache
*.pyc
*.pyd
*.pyo
1 change: 1 addition & 0 deletions test/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ if(HAS_CPPYY)
--cov-report=term-missing
--cov-report=xml:${CMAKE_BINARY_DIR}/coverage-python.xml
--cov-report=html:${CMAKE_BINARY_DIR}/coverage-python-html
--cov-config=${CMAKE_CURRENT_SOURCE_DIR}/.coveragerc
test_phlex.py
)
message(STATUS "Python tests will run with coverage reporting (pytest-cov)")
Expand Down
7 changes: 4 additions & 3 deletions test/python/check_sys_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Checker:
site-packages directory appears in Python's sys.path.
"""

__name__ = 'checker'
__name__ = "checker"

def __init__(self, venv_path: str):
"""Initialize the checker with the expected virtual environment path.
Expand All @@ -36,7 +36,8 @@ def __call__(self, i: int) -> None:
"""
assert len(sys.path) > 0
venv_site_packages = (
f"{sys.prefix}/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages"
f"{sys.prefix}/lib/python{sys.version_info.major}."
f"{sys.version_info.minor}/site-packages"
)
assert any(p == venv_site_packages for p in sys.path)

Expand All @@ -51,4 +52,4 @@ def PHLEX_REGISTER_ALGORITHMS(m, config):
Returns:
None
"""
m.observe(Checker(config["venv"]), input_family = config["input"])
m.observe(Checker(config["venv"]), input_family=config["input"])
Loading