From bb540f634209441630403de54ac5964a48946d3f Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Thu, 15 Sep 2022 12:27:07 +0000 Subject: [PATCH] Techdebt: Parallelize more tests (#5464) --- .github/workflows/build.yml | 1 + Makefile | 8 ++++---- docs/docs/contributing/development_tips/tests.rst | 2 +- tests/test_batch_simple/test_batch_jobs.py | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50f14cc91..398bc1590 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,6 +121,7 @@ jobs: runs-on: ubuntu-latest needs: lint strategy: + fail-fast: false matrix: python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] diff --git a/Makefile b/Makefile index f5f240d54..84f475f71 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,12 @@ TEST_NAMES = "*" ifeq ($(TEST_SERVER_MODE), true) # exclude test_kinesisvideoarchivedmedia # because testing with moto_server is difficult with data-endpoint - TEST_EXCLUDE := -k 'not (test_kinesisvideoarchivedmedia or test_awslambda or test_batch or test_ec2 or test_sqs)' + TEST_EXCLUDE := --ignore tests/test_kinesisvideoarchivedmedia --ignore tests/test_awslambda --ignore tests/test_batch --ignore tests/test_ec2 --ignore tests/test_sqs # Parallel tests will be run separate PARALLEL_TESTS := ./tests/test_awslambda ./tests/test_batch ./tests/test_ec2 ./tests/test_sqs else - TEST_EXCLUDE := - PARALLEL_TESTS := ./tests/test_core + TEST_EXCLUDE := --ignore tests/test_batch --ignore tests/test_ec2 --ignore tests/test_sqs + PARALLEL_TESTS := ./tests/test_batch ./tests/test_ec2 ./tests/test_sqs endif init: @@ -35,7 +35,7 @@ test-only: rm -f .coverage rm -rf cover pytest -sv --cov=moto --cov-report xml ./tests/ $(TEST_EXCLUDE) - MOTO_CALL_RESET_API=false pytest -n 4 $(PARALLEL_TESTS) + MOTO_CALL_RESET_API=false pytest --cov=moto --cov-report xml --cov-append -n 4 $(PARALLEL_TESTS) test: lint test-only diff --git a/docs/docs/contributing/development_tips/tests.rst b/docs/docs/contributing/development_tips/tests.rst index 63b0a566b..1168a4d85 100644 --- a/docs/docs/contributing/development_tips/tests.rst +++ b/docs/docs/contributing/development_tips/tests.rst @@ -40,7 +40,7 @@ To verify whether your tests pass in ServerMode, you can run the following comma Parallel tests ^^^^^^^^^^^^^^^^^^^^^ -To speed up our CI, the ServerMode tests for the `awslambda`, `batch`, `ec2` and `sqs` services will run in parallel. +To speed up our CI, the tests for the `awslambda`, `batch`, `ec2` and `sqs` services will run in parallel. This means the following: - Make sure you use unique names for functions/queues/etc diff --git a/tests/test_batch_simple/test_batch_jobs.py b/tests/test_batch_simple/test_batch_jobs.py index 0c1790223..146eb1e24 100644 --- a/tests/test_batch_simple/test_batch_jobs.py +++ b/tests/test_batch_simple/test_batch_jobs.py @@ -1,9 +1,10 @@ from ..test_batch import _get_clients, _setup import sure # noqa # pylint: disable=unused-import -from moto import mock_iam, mock_ec2, mock_ecs, mock_logs +from moto import mock_iam, mock_ec2, mock_ecs, mock_logs, settings from moto import mock_batch_simple from uuid import uuid4 +from unittest import SkipTest # Copy of test_batch/test_batch_jobs @@ -16,6 +17,9 @@ from uuid import uuid4 @mock_iam @mock_batch_simple def test_submit_job_by_name(): + if settings.TEST_SERVER_MODE: + raise SkipTest("No point in testing batch_simple in ServerMode") + ec2_client, iam_client, _, _, batch_client = _get_clients() _, _, _, iam_arn = _setup(ec2_client, iam_client)