Skip to content

Commit de4af6b

Browse files
test(shared): compare abs_lambda_path against a normalised path (#8457)
* fix(shared): keep LAMBDA_TASK_ROOT POSIX-shaped off Linux abs_lambda_path joined LAMBDA_TASK_ROOT with pathlib.Path, which is WindowsPath off Linux, so str(Path("/var/task", "")) returned "\var\task". The docstring promises the environment variable is used as given, and the repo's own test_abs_lambda_path_empty_envvar fails on an unmodified Windows checkout. CI is ubuntu-latest only, so it never surfaced there. The Lambda runtime is always Linux, so use PurePosixPath when LAMBDA_TASK_ROOT is set and keep the existing Path behaviour for the unset local case. Behaviour on Linux is unchanged. test_abs_lambda_path_w_filename_envvar built its expected value with the same platform-dependent Path call, so it passed either way and masked the bug; it now asserts the POSIX result directly. * test(shared): use native path expectation --------- Co-authored-by: Leandro <lcdama@amazon.pt>
1 parent 4810265 commit de4af6b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tests/unit/test_shared_functions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_abs_lambda_path_empty_envvar(default_lambda_path):
162162
# Given Env is set
163163
os.environ["LAMBDA_TASK_ROOT"] = default_lambda_path
164164
# Then path = Env/
165-
assert abs_lambda_path() == default_lambda_path
165+
assert abs_lambda_path() == str(Path(default_lambda_path))
166166

167167

168168
def test_abs_lambda_path_w_filename():

0 commit comments

Comments
 (0)