Skip to content

Add platform-specific skip marker for tests using sys.modules mocking #845

Add platform-specific skip marker for tests using sys.modules mocking

Add platform-specific skip marker for tests using sys.modules mocking #845

Workflow file for this run

name: Test Workflow with Coverage
on:
push:
branches:
- main
- dev
- demo
- hotfix
- dev-v4
- macae-v4-unittestcases-kd
pull_request:
types:
- opened
- ready_for_review
- reopened
- synchronize
branches:
- main
- dev
- demo
- hotfix
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r src/backend/requirements.txt
- name: Check if test files exist
id: check_tests
run: |
if [ -z "$(find src -type f -name 'test_*.py')" ]; then
echo "No test files found, skipping tests."
echo "skip_tests=true" >> $GITHUB_ENV
else
echo "Test files found, running tests."
echo "skip_tests=false" >> $GITHUB_ENV
fi
- name: Run tests with coverage
if: env.skip_tests == 'false'
run: |
python -m pytest src/tests/backend --cov=backend --cov-report=term --cov-config=.coveragerc
# - name: Run tests with coverage
# if: env.skip_tests == 'false'
# run: |
# pytest --cov=. --cov-report=term-missing --cov-report=xml --ignore=tests/e2e-test/tests
- name: Skip coverage report if no tests
if: env.skip_tests == 'true'
run: |
echo "Skipping coverage report because no tests were found."