Skip to content

Commit 62bd5a9

Browse files
committed
Merge branch 'topic/Fix-macos-test-failures' into 'master'
Fix macOS specific test failures See merge request it/e3-aws!102
2 parents 63acab0 + 73156d1 commit 62bd5a9

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/e3/aws/troposphere/asset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def checksum(self) -> str:
7070
return ""
7171

7272
fingerprint = sha256()
73-
for f in Path(self.data_dir).iterdir():
73+
# Sort files to ensure deterministic hash across different systems
74+
for f in sorted(Path(self.data_dir).iterdir()):
7475
if f in self._cached_ignored:
7576
continue
7677
fingerprint.update(f.relative_to(self.data_dir).as_posix().encode())

tests/tests_e3_aws/cfn/main/main_test.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from botocore.stub import ANY
1010
from e3.mock.os.process import mock_run, CommandResult
11+
from e3.os.process import which
1112
from e3.aws import AWSEnv, default_region
1213
from e3.aws.cfn import Stack
1314
from e3.aws.cfn.main import CFNMain
@@ -235,13 +236,14 @@ class MyCFNMain(CFNMain):
235236
def create_stack(self) -> Stack:
236237
return Stack(name="teststack")
237238

239+
git_path = which("git", default="/usr/bin/git")
238240
with mock_run(
239241
config={
240242
"results": [
241243
# Make CFNMain think we are on main
242244
CommandResult(
243245
cmd=[
244-
"/usr/bin/git",
246+
git_path,
245247
"-c",
246248
"fetch.prune=false",
247249
"branch",
@@ -252,7 +254,7 @@ def create_stack(self) -> Stack:
252254
# Make CFNMain detect some local changes
253255
CommandResult(
254256
cmd=[
255-
"/usr/bin/git",
257+
git_path,
256258
"-c",
257259
"fetch.prune=false",
258260
"status",
@@ -279,13 +281,14 @@ class MyCFNMain(CFNMain):
279281
def create_stack(self) -> Stack:
280282
return Stack(name="teststack")
281283

284+
git_path = which("git", default="/usr/bin/git")
282285
with mock_run(
283286
config={
284287
"results": [
285288
# Make CFNMain detect an incorrect branch
286289
CommandResult(
287290
cmd=[
288-
"/usr/bin/git",
291+
git_path,
289292
"-c",
290293
"fetch.prune=false",
291294
"branch",
@@ -364,13 +367,14 @@ def create_stack(self) -> Stack:
364367
)
365368
stubber.add_response("describe_stacks", {}, {"StackName": "teststack"})
366369

370+
git_path = which("git", default="/usr/bin/git")
367371
with default_region("us-east-1"), stubber, mock_run(
368372
config={
369373
"results": [
370374
# Make CFNMain think we are on main
371375
CommandResult(
372376
cmd=[
373-
"/usr/bin/git",
377+
git_path,
374378
"-c",
375379
"fetch.prune=false",
376380
"branch",
@@ -381,7 +385,7 @@ def create_stack(self) -> Stack:
381385
# Make CFNMain detect no local changes
382386
CommandResult(
383387
cmd=[
384-
"/usr/bin/git",
388+
git_path,
385389
"-c",
386390
"fetch.prune=false",
387391
"status",
@@ -391,7 +395,7 @@ def create_stack(self) -> Stack:
391395
# Make CFNMain detect an outdated branch
392396
CommandResult(
393397
cmd=[
394-
"/usr/bin/git",
398+
git_path,
395399
"-c",
396400
"fetch.prune=false",
397401
"fetch",

0 commit comments

Comments
 (0)