-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathconftest.py
51 lines (42 loc) · 1.62 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may
# not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
import pytest
import boto3
from acktest.aws.identity import get_region
from acktest import k8s
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")
def pytest_configure(config):
config.addinivalue_line(
"markers", "canary: mark test to also run in canary tests"
)
config.addinivalue_line(
"markers", "service(arg): mark test associated with a given service"
)
config.addinivalue_line(
"markers", "slow: mark test as slow to run"
)
def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
return
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
# Provide a k8s client to interact with the integration test cluster
@pytest.fixture(scope='class')
def k8s_client():
return k8s._get_k8s_api_client()
@pytest.fixture(scope='module')
def lambda_client():
return boto3.client('lambda', region_name=get_region())