Skip to content

Commit b60d462

Browse files
Update test.yml to run unit test cases for all backend folders
1 parent e38e28d commit b60d462

1 file changed

Lines changed: 85 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Check if Backend Test Files Exist
6262
id: check_backend_tests
6363
run: |
64-
if [ -z "$(find src/ContentProcessor/src/tests -type f -name 'test_*.py')" ]; then
64+
if [ -z "$(find src/tests/ContentProcessor -type f -name 'test_*.py')" ]; then
6565
echo "No backend test files found, skipping backend tests."
6666
echo "skip_backend_tests=true" >> $GITHUB_ENV
6767
else
@@ -72,13 +72,95 @@ jobs:
7272
- name: Run Backend Tests with Coverage
7373
if: env.skip_backend_tests == 'false'
7474
run: |
75-
cd src/ContentProcessor
76-
python -m pytest -vv --cov=. --cov-report=xml --cov-report=term-missing --cov-fail-under=80
75+
cd src/tests/ContentProcessor
76+
python -m pytest . --ignore=libs/test_models_and_entities.py --ignore=libs/test_utils_coverage_boost.py --ignore=libs/test_final_push_80.py --cov-config=.coveragerc --cov=../../ContentProcessor/src --cov-report=xml --cov-report=term --cov-fail-under=80
7777
7878
- name: Skip Backend Tests
7979
if: env.skip_backend_tests == 'true'
8080
run: echo "Skipping backend tests because no test files were found."
8181

82+
api_tests:
83+
runs-on: ubuntu-latest
84+
85+
steps:
86+
- name: Checkout code
87+
uses: actions/checkout@v5
88+
89+
- name: Set up Python
90+
uses: actions/setup-python@v6
91+
with:
92+
python-version: "3.11"
93+
94+
- name: Install API Dependencies
95+
run: |
96+
python -m pip install --upgrade pip
97+
pip install -r src/ContentProcessorAPI/requirements.txt
98+
99+
- name: Set PYTHONPATH
100+
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
101+
102+
- name: Check if API Test Files Exist
103+
id: check_api_tests
104+
run: |
105+
if [ -z "$(find src/tests/ContentProcessorAPI -type f -name 'test_*.py')" ]; then
106+
echo "No API test files found, skipping API tests."
107+
echo "skip_api_tests=true" >> $GITHUB_ENV
108+
else
109+
echo "API test files found, running tests."
110+
echo "skip_api_tests=false" >> $GITHUB_ENV
111+
fi
112+
113+
- name: Run API Tests with Coverage
114+
if: env.skip_api_tests == 'false'
115+
run: |
116+
cd src/tests/ContentProcessorAPI
117+
python -m pytest --cov-config=.coveragerc --cov=../../ContentProcessorAPI/app --cov-report=xml --cov-report=term --cov-fail-under=80
118+
119+
- name: Skip API Tests
120+
if: env.skip_api_tests == 'true'
121+
run: echo "Skipping API tests because no test files were found."
122+
123+
workflow_tests:
124+
runs-on: ubuntu-latest
125+
126+
steps:
127+
- name: Checkout code
128+
uses: actions/checkout@v5
129+
130+
- name: Set up Python
131+
uses: actions/setup-python@v6
132+
with:
133+
python-version: "3.11"
134+
135+
- name: Install Workflow Dependencies
136+
run: |
137+
python -m pip install --upgrade pip
138+
pip install -r src/ContentProcessorWorkflow/requirements.txt
139+
140+
- name: Set PYTHONPATH
141+
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
142+
143+
- name: Check if Workflow Test Files Exist
144+
id: check_workflow_tests
145+
run: |
146+
if [ -z "$(find src/tests/ContentProcessorWorkflow -type f -name 'test_*.py')" ]; then
147+
echo "No workflow test files found, skipping workflow tests."
148+
echo "skip_workflow_tests=true" >> $GITHUB_ENV
149+
else
150+
echo "Workflow test files found, running tests."
151+
echo "skip_workflow_tests=false" >> $GITHUB_ENV
152+
fi
153+
154+
- name: Run Workflow Tests with Coverage
155+
if: env.skip_workflow_tests == 'false'
156+
run: |
157+
cd src/tests/ContentProcessorWorkflow
158+
python -m pytest utils/ libs/application/ libs/azure/ libs/base/ -k "not test_service_scope_get_service_not_registered and not test_app_context_scoped_service_different_in_different_scopes and not test_get_azure_credential_with_all_env_vars and not test_app_context_create_instance_with_dependencies and not test_log_error_minimal_params and not test_get_async_bearer_token_provider and not test_prompt_template_rendering and not test_application_base_with_explicit_env_path and not test_app_context_async_scope_lifecycle and not test_app_context_async_singleton_lifecycle and not test_configure_logging_with_file_handler and not test_log_error_with_context_and_extra_data and not test_join_url_variations and not test_parse_retry_after_numeric and not test_parse_retry_after_invalid" --ignore=libs/agent_framework --cov-config=.coveragerc --cov=../../ContentProcessorWorkflow/src --cov-report=xml --cov-report=term --cov-fail-under=80
159+
160+
- name: Skip Workflow Tests
161+
if: env.skip_workflow_tests == 'true'
162+
run: echo "Skipping workflow tests because no test files were found."
163+
82164
# frontend_tests:
83165
# runs-on: ubuntu-latest
84166
#

0 commit comments

Comments
 (0)