forked from aws-powertools/powertools-lambda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
28 lines (22 loc) · 774 Bytes
/
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
from pathlib import Path
import pytest
from tests.e2e.metrics.infrastructure import MetricsStack
@pytest.fixture(autouse=True, scope="module")
def infrastructure(request: pytest.FixtureRequest, lambda_layer_arn: str):
"""Setup and teardown logic for E2E test infrastructure
Parameters
----------
request : pytest.FixtureRequest
pytest request fixture to introspect absolute path to test being executed
lambda_layer_arn : str
Lambda Layer ARN
Yields
------
Dict[str, str]
CloudFormation Outputs from deployed infrastructure
"""
stack = MetricsStack(handlers_dir=Path(f"{request.path.parent}/handlers"), layer_arn=lambda_layer_arn)
try:
yield stack.deploy()
finally:
stack.delete()