Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/pip/requirements/develop/pydan…
Browse files Browse the repository at this point in the history
…tic-core-2.10.0
  • Loading branch information
mildaniel authored Sep 26, 2023
2 parents 17e7ae4 + cc23e4c commit ebdcf65
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ jobs:
runs-on: ${{ matrix.os }}
env:
SAM_CLI_DEV: "1"
CI: true
strategy:
matrix:
os:
Expand Down
6 changes: 3 additions & 3 deletions requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ jsonpointer==2.4 \
--hash=sha256:15d51bba20eea3165644553647711d150376234112651b4f1811022aecad7d7a \
--hash=sha256:585cee82b70211fa9e6043b7bb89db6e1aa49524340dde8ad6b63206ea689d88
# via jsonpatch
jsonschema==4.19.0 \
--hash=sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb \
--hash=sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f
jsonschema==4.19.1 \
--hash=sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e \
--hash=sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf
# via
# aws-sam-cli (setup.py)
# aws-sam-translator
Expand Down
6 changes: 3 additions & 3 deletions requirements/reproducible-mac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,9 @@ jsonpointer==2.4 \
--hash=sha256:15d51bba20eea3165644553647711d150376234112651b4f1811022aecad7d7a \
--hash=sha256:585cee82b70211fa9e6043b7bb89db6e1aa49524340dde8ad6b63206ea689d88
# via jsonpatch
jsonschema==4.19.0 \
--hash=sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb \
--hash=sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f
jsonschema==4.19.1 \
--hash=sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e \
--hash=sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf
# via
# aws-sam-cli (setup.py)
# aws-sam-translator
Expand Down
6 changes: 3 additions & 3 deletions requirements/reproducible-win.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ jsonpointer==2.4 \
--hash=sha256:15d51bba20eea3165644553647711d150376234112651b4f1811022aecad7d7a \
--hash=sha256:585cee82b70211fa9e6043b7bb89db6e1aa49524340dde8ad6b63206ea689d88
# via jsonpatch
jsonschema==4.19.0 \
--hash=sha256:043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb \
--hash=sha256:6e1e7569ac13be8139b2dd2c21a55d350066ee3f80df06c608b398cdc6f30e8f
jsonschema==4.19.1 \
--hash=sha256:cd5f1f9ed9444e554b38ba003af06c0a8c2868131e56bfbef0550fb450c0330e \
--hash=sha256:ec84cc37cfa703ef7cd4928db24f9cb31428a5d0fa77747b8b51a847458e0bbf
# via
# aws-sam-cli (setup.py)
# aws-sam-translator
Expand Down
5 changes: 5 additions & 0 deletions samcli/local/docker/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ def _write_container_output(

@staticmethod
def _handle_data_writing(output_stream: Union[StreamWriter, io.BytesIO, io.TextIOWrapper], output_data: bytes):
# Decode the output and strip the string of carriage return characters. Stack traces are returned
# with carriage returns from the RIE. If these are left in the string then only the last line after
# the carriage return will be printed instead of the entire stack trace. Encode the string after cleaning
# to be printed by the correct output stream
output_data = output_data.decode("utf-8").replace("\r", os.linesep).encode("utf-8")
if isinstance(output_stream, StreamWriter):
output_stream.write_bytes(output_data)
output_stream.flush()
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
SKIP_DOCKER_MESSAGE,
run_command_with_input,
UpdatableSARTemplate,
RUNNING_ON_GITHUB_ACTIONS,
)
from .build_integ_base import (
BuildIntegBase,
Expand Down Expand Up @@ -488,6 +489,9 @@ class TestBuildCommand_PythonFunctions_WithoutDocker(BuildIntegPythonBase):

@pytest.mark.flaky(reruns=3)
def test_with_default_requirements(self):
if IS_WINDOWS and self.runtime == "python3.9" and RUNNING_ON_GITHUB_ACTIONS:
self.skipTest("Skipping python3.9 tests on Windows until GHA issue is resolved.")

self._test_with_default_requirements(
self.runtime,
self.codeuri,
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/local/invoke/test_integrations_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,3 +1195,25 @@ def test_invoke_inline_code_function(self):
raise

self.assertEqual(process.returncode, 1)


class TestInvokeFunctionWithError(InvokeIntegBase):
template = Path("template.yml")

def test_function_exception(self):
command_list = InvokeIntegBase.get_command_list(
function_to_invoke="RaiseExceptionFunction", template_path=self.template_path
)

expected_stack_trace = (
f"[ERROR] Exception: Lambda is raising an exception{os.linesep}"
f"Traceback (most recent call last):{os.linesep}"
f'\xa0\xa0File "/var/task/main.py", line 51, in raise_exception{os.linesep}'
f'\xa0\xa0\xa0\xa0raise Exception("Lambda is raising an exception")'
)

result = run_command(command_list)
stderr = result.stderr.decode("utf-8").strip()

self.assertEqual(result.process.returncode, 0)
self.assertIn(expected_stack_trace, stderr)
3 changes: 2 additions & 1 deletion tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

RUNNING_ON_APPVEYOR = os.environ.get("APPVEYOR", False)
IS_WINDOWS = platform.system().lower() == "windows"
RUNNING_ON_CI = RUNNING_ON_APPVEYOR or os.environ.get("CI", False)
RUNNING_ON_GITHUB_ACTIONS = os.environ.get("CI", False)
RUNNING_ON_CI = RUNNING_ON_APPVEYOR or RUNNING_ON_GITHUB_ACTIONS
RUNNING_TEST_FOR_MASTER_ON_CI = (
os.environ.get("APPVEYOR_REPO_BRANCH", os.environ.get("GITHUB_REF_NAME", "master")) != "master"
)
Expand Down

0 comments on commit ebdcf65

Please sign in to comment.