-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mypy config to exclude, and test selection via markers
- mypy was configred via `files` which fails when specifying a target dir. Now turned into an exclude in the config, and adding explicit files to the Makefile when a service is selected. - added SKIP_MYPY to be able to skip mypy check (as long as the mypy chnage is not complete) - using conftest.py to give all the tests default markers - the include/exclude from the makefile is now in the conftest.py marking as well - for services, also picking up test that reference that service in its name (specific pattern)
- Loading branch information
Showing
3 changed files
with
298 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import pytest | ||
|
||
SERVICES = ( | ||
"acm", | ||
"acmpca", | ||
"amp", | ||
"apigateway", | ||
"apigatewayv2", | ||
"applicationautoscaling", | ||
"appsync", | ||
"athena", | ||
"autoscaling", | ||
"awslambda", | ||
"batch", | ||
"batch_simple", | ||
"budgets", | ||
"ce", | ||
"cloudformation", | ||
"cloudfront", | ||
"cloudtrail", | ||
"cloudwatch", | ||
"codebuild", | ||
"codecommit", | ||
"codepipeline", | ||
"cognitoidentity", | ||
"cognitoidp", | ||
"comprehend", | ||
"config", | ||
"databrew", | ||
"datapipeline", | ||
"datasync", | ||
"dax", | ||
"dms", | ||
"ds", | ||
"dynamodb", | ||
"dynamodb_v20111205", | ||
"dynamodbstreams", | ||
"ebs", | ||
"ec2", | ||
"ec2instanceconnect", | ||
"ecr", | ||
"ecs", | ||
"efs", | ||
"eks", | ||
"elasticache", | ||
"elasticbeanstalk", | ||
"elastictranscoder", | ||
"elb", | ||
"elbv2", | ||
"emr", | ||
"emrcontainers", | ||
"emrserverless", | ||
"es", | ||
"events", | ||
"firehose", | ||
"forecast", | ||
"glacier", | ||
"glue", | ||
"greengrass", | ||
"guardduty", | ||
"iam", | ||
"identitystore", | ||
"instance_metadata", | ||
"iot", | ||
"iotdata", | ||
"kinesis", | ||
"kinesisvideo", | ||
"kinesisvideoarchivedmedia", | ||
"kms", | ||
"logs", | ||
"managedblockchain", | ||
"mediaconnect", | ||
"medialive", | ||
"mediapackage", | ||
"mediastore", | ||
"mediastoredata", | ||
"meteringmarketplace", | ||
"moto_api", | ||
"moto_server", | ||
"mq", | ||
"neptune", | ||
"opsworks", | ||
"organizations", | ||
"packages", | ||
"personalize", | ||
"pinpoint", | ||
"polly", | ||
"quicksight", | ||
"ram", | ||
"rds", | ||
"redshift", | ||
"redshiftdata", | ||
"rekognition", | ||
"resourcegroups", | ||
"resourcegroupstaggingapi", | ||
"route53", | ||
"route53resolver", | ||
"s3", | ||
"s3bucket_path", | ||
"s3control", | ||
"sagemaker", | ||
"sdb", | ||
"secretsmanager", | ||
"servicediscovery", | ||
"servicequotas", | ||
"ses", | ||
"signer", | ||
"sns", | ||
"sqs", | ||
"ssm", | ||
"ssoadmin", | ||
"stepfunctions", | ||
"sts", | ||
"support", | ||
"swf", | ||
"textract", | ||
"timestreamwrite", | ||
"transcribe", | ||
"utilities", | ||
"wafv2", | ||
"xray", | ||
) | ||
|
||
|
||
EXTRA_MARKERS_TEST_DIRS = { | ||
"acm": (pytest.mark.parallel_server_only,), | ||
"acmpca": (pytest.mark.parallel_server_only,), | ||
"amp": (pytest.mark.parallel_server_only,), | ||
"awslambda": (pytest.mark.parallel_server_only,), | ||
"batch": (pytest.mark.parallel,), | ||
"ec2": (pytest.mark.parallel,), | ||
# exclude test_kinesisvideoarchivedmedia | ||
# because testing with moto_server is difficult with data-endpoint | ||
"kinesisvideoarchivedmedia": (pytest.mark.skip_server,), | ||
"sqs": (pytest.mark.parallel,), | ||
} | ||
|
||
|
||
def pytest_collection_modifyitems(items): # noqa: SC200 | ||
for item in items: | ||
for service, markers in EXTRA_MARKERS_TEST_DIRS.items(): | ||
if f"tests/test_{service}/" in item.nodeid: # noqa: SC200 | ||
for marker in markers: | ||
item.add_marker(marker) | ||
for service in SERVICES: | ||
if f"tests/test_{service}/" in item.nodeid: # noqa: SC200 | ||
item.add_marker(getattr(pytest.mark, service)) | ||
if f"_{service}.py" in item.nodeid: | ||
item.add_marker(getattr(pytest.mark, service)) |