Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c259c03
reverse logic that checks if filter matches context
truib Mar 27, 2025
6b60be3
fix hound issues
truib Mar 27, 2025
f40589d
update tests for filters
truib Mar 27, 2025
c78feb0
update pytests
truib Mar 27, 2025
e5aca36
remove unused variable
truib Mar 27, 2025
0c01df6
Revert "update pytests"
truib Mar 30, 2025
41ef804
refactoring check_*filters functions
truib Mar 30, 2025
da091c9
add string conversion for ACCEL filter
truib Apr 1, 2025
3d1899d
adjust tests for filters to use additional argument
truib Apr 1, 2025
7425284
Merge branch 'develop' of github.com:EESSI/eessi-bot-software-layer i…
truib Apr 21, 2025
43a2832
ignore local .vscode directory
truib Apr 21, 2025
2e260a7
additional tests to increase test coverage + minor style improvements
truib Apr 21, 2025
715a8fa
add coverage step to CI workflow
truib Apr 21, 2025
f28e412
bump image to ubuntu 22.04
truib Apr 21, 2025
24d4df7
remove trailing whitespace
truib Apr 21, 2025
d497de7
drop 3.6, add 3.12; drop pytest-cov; include all *.py except tests/*
truib Apr 21, 2025
6504e15
improve find
truib Apr 21, 2025
8159572
test that tries to import all python files and thus ensures that all …
truib Apr 21, 2025
34a46f2
list files for which coverage report should be created
truib Apr 21, 2025
a6f253d
fix flake8 issues
truib Apr 21, 2025
6ff0277
upload coverage reports as artifacts
truib Apr 21, 2025
c53a696
comment upload step
truib Apr 21, 2025
29487db
update step that uploads artifacts
truib Apr 21, 2025
dbe1540
comment out upload of coverage report; postpone this to a subsequent …
truib Apr 21, 2025
528f6da
polish .coveragerc
truib Apr 21, 2025
a76ae33
cleanup naming of test step
truib Apr 21, 2025
8f870fd
use check_build_filters
truib Apr 21, 2025
71b9995
add log messages to check_filters
truib Apr 21, 2025
46a4f75
strip leading OS name from architecture value if it starts with linux
truib Apr 21, 2025
63715f5
Merge branch 'develop' of github.com:EESSI/eessi-bot-software-layer i…
truib May 22, 2025
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
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
omit =
tests/*
*/tests/*
*/test/*
*test_*.py
*/__pycache__/*
*/venv/*
24 changes: 20 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,30 @@ jobs:
python -m pip install pytest
python -m pip install --upgrade flake8

- name: Run test suite (without coverage)
- name: Run test suite
run: |
./test.sh --verbose

- name: Run test suite (with coverage)
- name: Run coverage and create report
run: |
python -m pip install pytest-cov
./test.sh -q --cov=$PWD
python -m pip install coverage
PYTHON_SOURCES=$(find . -name "*.py" -not -path "tests/*" -not -path ".github/*" | tr '\n' ',' | sed 's/,$//')
echo "determine coverage of pytests for:"
echo "${PYTHON_SOURCES}" | tr ',' '\n' | sed 's/^\.\///' | awk '{print gsub(/\//, "/"), $0}' | sort -n | cut -d' ' -f2- | tree --fromfile -U
coverage run --include="${PYTHON_SOURCES}" -m pytest
coverage report -m
coverage html

# - name: Upload coverage report
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v 4.6.2
# with:
# name: coverage-report-python-${{ matrix.python }}
# path: htmlcov/
# retention-days: 7
# compression-level: 6 # default GNU Gzip level
# if-no-files-found: warn
# overwrite: false
# include-hidden-files: false

- name: Run flake8 to verify PEP8-compliance of Python code
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ appbackup.cfg
venv_bot_p37
*.swo
events_log/
.vscode/
2 changes: 1 addition & 1 deletion tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def prepare_jobs(pr, cfg, event_info, action_filter):
log(f"{fn}(): checking filter {action_filter.to_string()}")
context = {"architecture": arch, "repository": repo_id, "instance": app_name}
log(f"{fn}(): context is '{json.dumps(context, indent=4)}'")
if not action_filter.check_filters(context):
if not action_filter.check_build_filters(context):
log(f"{fn}(): context does NOT satisfy filter(s), skipping")
continue
else:
Expand Down
37 changes: 37 additions & 0 deletions tests/test_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import importlib


def test_import_all_python_files():
"""Test that imports all Python files to ensure they appear in coverage reports."""
# Get the project root directory (where this test file is located)
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# List of directories to scan for Python files
dirs_to_scan = ['connections', 'tasks', 'tools']

# Import all Python files
for dir_name in dirs_to_scan:
dir_path = os.path.join(project_root, dir_name)
if os.path.exists(dir_path):
for file_name in os.listdir(dir_path):
if file_name.endswith('.py') and not file_name.startswith('__'):
module_name = f"{dir_name}.{file_name[:-3]}"
try:
importlib.import_module(module_name)
except ImportError as e:
# Log the error but don't fail the test
print(f"Could not import {module_name}: {e}")

# Import root Python files
for file_name in os.listdir(project_root):
if file_name.endswith('.py') and not file_name.startswith('__'):
module_name = file_name[:-3]
try:
importlib.import_module(module_name)
except ImportError as e:
# Log the error but don't fail the test
print(f"Could not import {module_name}: {e}")

# The test always passes as its purpose is just to import files
assert True
Loading