Skip to content

Commit 2917cbb

Browse files
committed
feat: add ty dependency and update projen and pytest versions in uv.lock
1 parent 3732fdd commit 2917cbb

File tree

5 files changed

+53
-38
lines changed

5 files changed

+53
-38
lines changed

src/bin/env_helper.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ def cdk_action_task(project: AwsCdkPythonApp, target_account: Dict[str, str]):
1919

2020
project.add_task(
2121
task_name,
22-
**{
23-
"description": task_description,
24-
"env": target_account,
25-
"exec": exec_command,
26-
},
22+
description=task_description,
23+
env=target_account,
24+
exec=exec_command,
2725
)

src/custom_constructs/network_construct.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ def __init__(self, scope: Construct, id: str):
1818
super().__init__(scope, id)
1919

2020
# Determine bucket properties based on the environment
21-
if self.environment == "production":
22-
bucket_props = {}
23-
else:
24-
bucket_props = {
25-
"auto_delete_objects": True,
26-
"removal_policy": RemovalPolicy.DESTROY,
27-
}
21+
is_production = self.environment == "production"
2822

2923
# Create a VPC with 9 subnets divided over 3 AZs (3 public, 3 private, 3 isolated)
3024
cidr = (
@@ -50,7 +44,10 @@ def __init__(self, scope: Construct, id: str):
5044
"VpcFlowLogBucket",
5145
encryption=s3.BucketEncryption.S3_MANAGED,
5246
block_public_access=s3.BlockPublicAccess.BLOCK_ALL,
53-
**bucket_props,
47+
auto_delete_objects=None if is_production else True,
48+
removal_policy=None
49+
if is_production
50+
else RemovalPolicy.DESTROY,
5451
)
5552
),
5653
traffic_type=ec2.FlowLogTrafficType.REJECT,

tests/test_example.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
from aws_cdk import App
33
from aws_cdk.assertions import Template
44

5-
from aws_cdk_python_starterkit.main import MyStack
5+
from stacks.base_stack import BaseStack
66

7-
@pytest.fixture(scope='module')
7+
8+
@pytest.fixture(scope="module")
89
def template():
9-
app = App()
10-
stack = MyStack(app, "my-stack-test")
11-
template = Template.from_stack(stack)
12-
yield template
10+
app = App()
11+
stack = BaseStack(app, "my-stack-test")
12+
template = Template.from_stack(stack)
13+
yield template
14+
1315

1416
def test_no_buckets_found(template):
15-
template.resource_count_is("AWS::S3::Bucket", 0)
17+
template.resource_count_is("AWS::S3::Bucket", 0)

ty.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[environment]
2+
extra-paths = ["src"]

uv.lock

Lines changed: 34 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)