Skip to content

Commit c449c4c

Browse files
AlanCodingsimaishi
andauthored
Combine Django bump with other fixes to github checks (ansible#16015)
* Add no cov on fail flag to fix CI * Bump django to 4.2.21 * Coverage args * Try cov equals awx * Run migration test in parallel * Ignore error and clean up commands * Try to make schema check not hang --------- Co-authored-by: Satoe Imaishi <[email protected]>
1 parent 31ee509 commit c449c4c

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ COLLECTION_VERSION ?= $(shell $(PYTHON) tools/scripts/scm_version.py | cut -d .
1919
COLLECTION_SANITY_ARGS ?= --docker
2020
# collection unit testing directories
2121
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
22+
# pytest added args to collect coverage
23+
COVERAGE_ARGS ?= --cov=awx --cov-report=xml --junitxml=reports/junit.xml --no-cov-on-fail
24+
# pytest test directories
25+
TEST_DIRS ?= awx/main/tests/unit awx/main/tests/functional awx/conf/tests
26+
# pytest args to run tests in parallel
27+
PARALLEL_TESTS ?= -n auto
2228
# collection integration test directories (defaults to all)
2329
COLLECTION_TEST_TARGET ?=
2430
# args for collection install
@@ -316,7 +322,7 @@ swagger: reports
316322
@if [ "$(VENV_BASE)" ]; then \
317323
. $(VENV_BASE)/awx/bin/activate; \
318324
fi; \
319-
(set -o pipefail && py.test --cov --cov-report=xml --junitxml=reports/junit.xml $(PYTEST_ARGS) awx/conf/tests/functional awx/main/tests/functional/api awx/main/tests/docs | tee reports/$@.report)
325+
(set -o pipefail && py.test $(COVERAGE_ARGS) $(PARALLEL_TESTS) awx/conf/tests/functional awx/main/tests/functional/api awx/main/tests/docs | tee reports/$@.report)
320326
@if [ "${GITHUB_ACTIONS}" = "true" ]; \
321327
then \
322328
echo 'cov-report-files=reports/coverage.xml' >> "${GITHUB_OUTPUT}"; \
@@ -334,14 +340,12 @@ api-lint:
334340
awx-link:
335341
[ -d "/awx_devel/awx.egg-info" ] || $(PYTHON) /awx_devel/tools/scripts/egg_info_dev
336342

337-
TEST_DIRS ?= awx/main/tests/unit awx/main/tests/functional awx/conf/tests
338-
PYTEST_ARGS ?= -n auto
339343
## Run all API unit tests.
340344
test:
341345
if [ "$(VENV_BASE)" ]; then \
342346
. $(VENV_BASE)/awx/bin/activate; \
343347
fi; \
344-
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider $(PYTEST_ARGS) $(TEST_DIRS)
348+
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider $(PARALLEL_TESTS) $(TEST_DIRS)
345349
cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3
346350
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
347351

@@ -350,15 +354,15 @@ live_test:
350354

351355
## Run all API unit tests with coverage enabled.
352356
test_coverage:
353-
$(MAKE) test PYTEST_ARGS="--create-db --cov --cov-report=xml --junitxml=reports/junit.xml"
357+
$(MAKE) test PYTEST_ARGS="--create-db $(COVERAGE_ARGS)"
354358
@if [ "${GITHUB_ACTIONS}" = "true" ]; \
355359
then \
356360
echo 'cov-report-files=awxkit/coverage.xml,reports/coverage.xml' >> "${GITHUB_OUTPUT}"; \
357361
echo 'test-result-files=awxkit/report.xml,reports/junit.xml' >> "${GITHUB_OUTPUT}"; \
358362
fi
359363

360364
test_migrations:
361-
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider --migrations -m migration_test --create-db --cov=awx --cov-report=xml --junitxml=reports/junit.xml $(PYTEST_ARGS) $(TEST_DIRS)
365+
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider --migrations -m migration_test --create-db $(PARALLEL_TESTS) $(COVERAGE_ARGS) $(TEST_DIRS)
362366
@if [ "${GITHUB_ACTIONS}" = "true" ]; \
363367
then \
364368
echo 'cov-report-files=reports/coverage.xml' >> "${GITHUB_OUTPUT}"; \
@@ -376,7 +380,7 @@ test_collection:
376380
fi && \
377381
if ! [ -x "$(shell command -v ansible-playbook)" ]; then pip install ansible-core; fi
378382
ansible --version
379-
py.test $(COLLECTION_TEST_DIRS) --cov --cov-report=xml --junitxml=reports/junit.xml -v
383+
py.test $(COLLECTION_TEST_DIRS) $(COVERAGE_ARGS) -v
380384
@if [ "${GITHUB_ACTIONS}" = "true" ]; \
381385
then \
382386
echo 'cov-report-files=reports/coverage.xml' >> "${GITHUB_OUTPUT}"; \

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ markers =
1515
filterwarnings =
1616
error
1717

18+
# Breaks coverage combined with pytest-mp, surfacing as an unhandled error outside of test scope
19+
ignore:Module awx was previously imported, but not measured:coverage.exceptions.CoverageWarning
20+
1821
# FIXME: Upgrade protobuf https://github.com/protocolbuffers/protobuf/issues/15077
1922
once:Type google._upb._message.* uses PyType_Spec with a metaclass that has custom tp_new:DeprecationWarning
2023

requirements/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cryptography<42.0.0 # investigation is needed for 42+ to work with OpenSSL v3.0
1414
Cython
1515
daphne
1616
distro
17-
django==4.2.20 # CVE-2025-26699
17+
django==4.2.21 # CVE-2025-32873
1818
django-cors-headers
1919
django-crum
2020
django-extensions

requirements/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ dispatcherd==2025.5.21
132132
# via -r /awx_devel/requirements/requirements.in
133133
distro==1.9.0
134134
# via -r /awx_devel/requirements/requirements.in
135-
django==4.2.20
135+
django==4.2.21
136136
# via
137137
# -r /awx_devel/requirements/requirements.in
138138
# channels
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
2-
set +x
2+
set -euo pipefail
33

44
cd /awx_devel
55
make clean
66
make awx-link
77

8-
if [[ ! $@ ]]; then
8+
if [[ $# -eq 0 ]]; then
99
make test
1010
else
11-
make $@
11+
make "$@"
1212
fi

0 commit comments

Comments
 (0)