2013-02-18 16:09:40 -05:00
|
|
|
SHELL := /bin/bash
|
|
|
|
|
2022-04-16 10:02:57 +00:00
|
|
|
SERVICE_NAME = "default"
|
|
|
|
TEST_NAMES = "*"
|
|
|
|
|
2017-11-10 18:44:02 +09:00
|
|
|
ifeq ($(TEST_SERVER_MODE), true)
|
2020-09-04 20:14:48 +09:00
|
|
|
# exclude test_kinesisvideoarchivedmedia
|
|
|
|
# because testing with moto_server is difficult with data-endpoint
|
2023-02-08 21:56:51 -01:00
|
|
|
TEST_EXCLUDE := --ignore tests/test_kinesisvideoarchivedmedia --ignore tests/test_acm --ignore tests/test_amp --ignore tests/test_awslambda --ignore tests/test_batch --ignore tests/test_ec2 --ignore tests/test_sqs
|
2021-10-05 17:11:07 +00:00
|
|
|
# Parallel tests will be run separate
|
2023-02-08 21:56:51 -01:00
|
|
|
PARALLEL_TESTS := ./tests/test_acm/ ./tests/test_acmpca/ ./tests/test_amp/ ./tests/test_awslambda ./tests/test_batch ./tests/test_ec2 ./tests/test_sqs
|
2017-11-10 18:44:02 +09:00
|
|
|
else
|
2022-09-15 12:27:07 +00:00
|
|
|
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
|
2017-11-10 18:44:02 +09:00
|
|
|
endif
|
|
|
|
|
2013-02-18 16:09:40 -05:00
|
|
|
init:
|
2023-01-06 19:43:16 +00:00
|
|
|
@pip install -e .
|
2019-07-08 20:42:24 -05:00
|
|
|
@pip install -r requirements-dev.txt
|
2013-02-18 16:09:40 -05:00
|
|
|
|
2017-03-12 20:18:49 -04:00
|
|
|
lint:
|
2023-09-03 15:16:24 +09:00
|
|
|
@echo "Running ruff..."
|
|
|
|
ruff check moto tests
|
2022-03-10 13:39:59 -01:00
|
|
|
@echo "Running black... "
|
2022-10-03 17:28:28 -04:00
|
|
|
$(eval black_version := $(shell grep "^black==" requirements-dev.txt | sed "s/black==//"))
|
2022-04-20 00:18:28 +02:00
|
|
|
@echo "(Make sure you have black-$(black_version) installed, as other versions will produce different results)"
|
2019-10-26 18:47:45 -07:00
|
|
|
black --check moto/ tests/
|
2022-03-10 13:39:59 -01:00
|
|
|
@echo "Running pylint..."
|
2022-01-14 18:51:49 -01:00
|
|
|
pylint -j 0 moto tests
|
2022-10-06 08:37:35 +00:00
|
|
|
@echo "Running MyPy..."
|
2022-10-11 13:16:27 +00:00
|
|
|
mypy --install-types --non-interactive
|
2017-03-12 20:18:49 -04:00
|
|
|
|
2020-12-03 18:32:06 +00:00
|
|
|
format:
|
|
|
|
black moto/ tests/
|
|
|
|
|
2019-10-26 18:47:45 -07:00
|
|
|
test-only:
|
2021-01-26 12:37:03 +00:00
|
|
|
rm -f .coverage
|
|
|
|
rm -rf cover
|
2023-03-12 17:54:50 +01:00
|
|
|
pytest -sv -rs --cov=moto --cov-report xml ./tests/ $(TEST_EXCLUDE)
|
2022-11-02 20:00:51 -01:00
|
|
|
# https://github.com/aws/aws-xray-sdk-python/issues/196 - Run these tests separately without Coverage enabled
|
2023-03-12 17:54:50 +01:00
|
|
|
pytest -sv -rs ./tests/test_xray
|
2023-08-31 06:47:49 +00:00
|
|
|
MOTO_CALL_RESET_API=false pytest -sv --cov=moto --cov-report xml --cov-append -n 4 $(PARALLEL_TESTS) --dist loadscope
|
2018-11-27 16:12:41 +00:00
|
|
|
|
2019-10-26 18:47:45 -07:00
|
|
|
test: lint test-only
|
|
|
|
|
2022-04-16 10:02:57 +00:00
|
|
|
terraformtests:
|
|
|
|
@echo "Make sure that the MotoServer is already running on port 4566 (moto_server -p 4566)"
|
|
|
|
@echo "USAGE: make terraformtests SERVICE_NAME=acm TEST_NAMES=TestAccACMCertificate"
|
|
|
|
@echo ""
|
|
|
|
cd tests/terraformtests && bin/run_go_test $(SERVICE_NAME) "$(TEST_NAMES)"
|
|
|
|
|
2017-02-23 19:43:48 -05:00
|
|
|
test_server:
|
2021-02-02 18:01:00 +00:00
|
|
|
@TEST_SERVER_MODE=true pytest -sv --cov=moto --cov-report xml ./tests/
|
2017-02-23 19:43:48 -05:00
|
|
|
|
2017-09-19 14:01:08 -07:00
|
|
|
aws_managed_policies:
|
|
|
|
scripts/update_managed_policies.py
|
|
|
|
|
2017-10-25 12:28:18 +02:00
|
|
|
implementation_coverage:
|
2018-06-01 12:30:42 +02:00
|
|
|
./scripts/implementation_coverage.py
|
2017-11-20 12:13:44 -08:00
|
|
|
git commit IMPLEMENTATION_COVERAGE.md -m "Updating implementation coverage" || true
|
2017-10-25 12:28:18 +02:00
|
|
|
|
2023-03-27 11:56:19 -05:00
|
|
|
cloudformation_coverage:
|
2023-04-11 14:31:46 +00:00
|
|
|
./scripts/cloudformation_coverage.py
|
2023-03-27 11:56:19 -05:00
|
|
|
git commit CLOUDFORMATION_COVERAGE.md -m "Updating CloudFormation coverage" || true
|
|
|
|
|
|
|
|
coverage: implementation_coverage cloudformation_coverage
|
|
|
|
|
2017-09-22 19:23:10 +09:00
|
|
|
scaffold:
|
|
|
|
@pip install -r requirements-dev.txt > /dev/null
|
2017-09-25 14:11:11 -07:00
|
|
|
exec python scripts/scaffold.py
|
2020-09-13 16:08:23 +01:00
|
|
|
|
|
|
|
int_test:
|
|
|
|
@./scripts/int_test.sh
|