-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from HDE/master
Release v0.1.7
- Loading branch information
Showing
13 changed files
with
105 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,6 @@ target/ | |
|
||
# Python environment | ||
.python-version | ||
|
||
# Vitual Environments | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
''' | ||
Copyright 2015-2017 HDE, Inc. | ||
Copyright 2015-2018 HDE, Inc. | ||
Licensed under MIT. | ||
''' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
''' | ||
Copyright 2015-2017 HDE, Inc. | ||
Copyright 2015-2018 HDE, Inc. | ||
Licensed under MIT. | ||
''' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
''' | ||
Copyright 2015-2017 HDE, Inc. | ||
Copyright 2015-2018 HDE, Inc. | ||
Licensed under MIT. | ||
''' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
''' | ||
python-lambda-local: Test Direct Inovactions | ||
(command-line and direct). | ||
Meant for use with py.test. | ||
Copyright 2015 HDE, Inc. | ||
Licensed under MIT | ||
''' | ||
import json | ||
import argparse | ||
from multiprocessing import Process | ||
import os | ||
from lambda_local.main import run as lambda_run | ||
from lambda_local.main import call as lambda_call | ||
|
||
|
||
def my_lambda_function(event, context): | ||
print("Hello World from My Lambda Function!") | ||
return 42 | ||
|
||
def test_function_call_for_pytest(): | ||
request = json.dumps({}) | ||
(result, error_type) = lambda_call(func=my_lambda_function, event=request, timeout=1) | ||
|
||
assert error_type is None | ||
|
||
assert result == 42 | ||
|
||
|
||
def test_check_command_line(): | ||
request = json.dumps({}) | ||
request_file = 'check_command_line_event.json' | ||
with open (request_file, "w") as f: | ||
f.write(request) | ||
|
||
args = argparse.Namespace(event=request_file, | ||
file='tests/test_direct_invocations.py', | ||
function='my_lambda_function', | ||
timeout=1, | ||
environment_variables='', | ||
library=None, | ||
version_name='', | ||
arn_string='' | ||
) | ||
p = Process(target=lambda_run, args=(args,)) | ||
p.start() | ||
p.join() | ||
|
||
os.remove(request_file) | ||
assert p.exitcode == 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters