File tree Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Expand file tree Collapse file tree 5 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 11language : python
22python :
3- - " 2.6"
43 - " 2.7"
54 - " 3.3"
65 - " 3.4"
Original file line number Diff line number Diff line change @@ -752,7 +752,7 @@ def get_concurrency(cfg):
752752
753753
754754def read_cfg (path_to_config_file , profile_name ):
755- cfg = read (path_to_config_file , loader = yaml .load )
755+ cfg = read (path_to_config_file , loader = yaml .full_load )
756756 if profile_name is not None :
757757 cfg ['profile' ] = profile_name
758758 elif 'AWS_PROFILE' in os .environ :
Original file line number Diff line number Diff line change 11bumpversion==0.5.3
22pre-commit==0.15.0
3- pytest
3+ pytest>=3.6
44pytest-cov
55flake8
Original file line number Diff line number Diff line change 55class TestLambdaContext (unittest .TestCase ):
66
77 def test_get_remaining_time_in_millis (self ):
8- context = LambdaContext ('function_name' ,2000 )
8+ context = LambdaContext ('function_name' , 2000 )
99 time .sleep (.5 )
10- self .assertTrue (context .get_remaining_time_in_millis () < 2000 )
10+ self .assertTrue (context .get_remaining_time_in_millis () < 2000000 )
1111
1212
1313if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1+ import os
2+ import unittest
3+ import yaml
4+ from aws_lambda .helpers import read
5+
6+
7+ class TestReadHelper (unittest .TestCase ):
8+
9+ TEST_FILE = 'readTmp.txt'
10+
11+ def setUp (self ):
12+ with open (TestReadHelper .TEST_FILE , 'w' ) as tmp_file :
13+ tmp_file .write ('testYaml: testing' )
14+
15+ def tearDown (self ):
16+ os .remove (TestReadHelper .TEST_FILE )
17+
18+ def test_read_no_loader_non_binary (self ):
19+ fileContents = read (TestReadHelper .TEST_FILE )
20+ self .assertEqual (fileContents , 'testYaml: testing' )
21+
22+ def test_read_yaml_loader_non_binary (self ):
23+ testYaml = read (TestReadHelper .TEST_FILE , loader = yaml .full_load )
24+ self .assertEqual (testYaml ['testYaml' ], 'testing' )
25+
26+ def test_read_no_loader_binary_mode (self ):
27+ fileContents = read (TestReadHelper .TEST_FILE , binary_file = True )
28+ self .assertEqual (fileContents , b'testYaml: testing' )
29+
30+ def test_read_yaml_loader_binary_mode (self ):
31+ testYaml = read (
32+ TestReadHelper .TEST_FILE ,
33+ loader = yaml .full_load ,
34+ binary_file = True
35+ )
36+ self .assertEqual (testYaml ['testYaml' ], 'testing' )
You can’t perform that action at this time.
0 commit comments