Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# R0205,W0107,R1705,R1710,R1719,R1720,R1714 are all disable due to a forced upgrade to support python3.8
disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,C0301, R0205,W0107,R1705,R1710,R1719,R1720,R1714
# R1725,W0707 can be removed when we drop Python 2 support
disable=R0201,W0613,I0021,I0020,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,C0301, R0205,W0107,R1705,R1710,R1719,R1720,R1714,R1725,W0707


[REPORTS]
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def main(self, args, env_vars=None, shim=None):
class PipRunner(object):
"""Wrapper around pip calls used by chalice."""

_LINK_IS_DIR_PATTERN = "Processing (.+?)\n" " Link is a directory," " ignoring download_dir"
_LINK_IS_DIR_PATTERN = "Processing (.+?)\n Link is a directory, ignoring download_dir"

def __init__(self, python_exe, pip, osutils=None):
if osutils is None:
Expand Down
29 changes: 16 additions & 13 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
coverage==4.3.4
coverage==5.3
flake8==3.3.0; python_version < '3.8'
flake8==3.7.9; python_version >= '3.8'
pytest-cov==2.4.0
# astroid > 2.0.4 is not compatible with pylint1.7
astroid>=1.5.8,<2.1.0; python_version < '3.8'
pylint==1.7.2; python_version < '3.8'
pylint==2.4.4; python_version >= '3.8'
flake8==3.8.4; python_version >= '3.8'
pytest-cov==2.10.1

# pylint 2 does not support Python 2. pylint 1.x requires astroid 1.x
astroid~=1.6.0; python_version < '3.6'
pylint~=1.9.5; python_version < '3.6'
pylint~=2.6.0; python_version >= '3.6'
isort>=4.2.5,<5; python_version < '3.8'

# Test requirements
pytest==3.0.7
py==1.4.33
mock==2.0.0
parameterized==0.6.1
pytest>=6.1.1; python_version >= '3.6'
pytest~=4.6.11; python_version < '3.6' # pytest dropped python 2 support after 4.6.x
mock==3.0.5; python_version < '3.6'
mock==4.0.2; python_version >= '3.6'
parameterized==0.7.4
pathlib2==2.3.2; python_version<"3.4"
futures==3.2.0; python_version<"3.2.3"
# Py3.2 backport
backports.tempfile==1.0

# tempfile backport for < 3.6
backports.tempfile==1.0; python_version<"3.7"
2 changes: 1 addition & 1 deletion tests/functional/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ def test_run_hello_workflow_with_exec_paths(self):
with open(self.expected_filename, "r") as fp:
contents = fp.read()

self.assertEquals(contents, self.expected_contents)
self.assertEqual(contents, self.expected_contents)
6 changes: 3 additions & 3 deletions tests/functional/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ def test_run_hello_workflow_with_backcompat(self, flavor, protocol_version):
response = json.loads(stdout_data)
self.assertNotIn("error", response)
self.assertIn("result", response)
self.assertEquals(response["result"]["artifacts_dir"], self.artifacts_dir)
self.assertEqual(response["result"]["artifacts_dir"], self.artifacts_dir)

self.assertTrue(os.path.exists(self.expected_filename))
contents = ""
with open(self.expected_filename, "r") as fp:
contents = fp.read()

self.assertEquals(contents, self.expected_contents)
self.assertEqual(contents, self.expected_contents)
shutil.rmtree(self.scratch_dir)

@parameterized.expand([("request_through_stdin"), ("request_through_argument")])
Expand Down Expand Up @@ -160,4 +160,4 @@ def test_run_hello_workflow_incompatible(self, flavor):
# Validate the response object. It should be error response
response = json.loads(stdout_data)
self.assertIn("error", response)
self.assertEquals(response["error"]["code"], 505)
self.assertEqual(response["error"]["code"], 505)
8 changes: 4 additions & 4 deletions tests/functional/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def test_must_respect_excludes_list(self):
excludes = [".git", ".aws-sam", "*.pyc"]

copytree(self.source, self.dest, ignore=shutil.ignore_patterns(*excludes))
self.assertEquals(set(os.listdir(self.dest)), {"nested", "a"})
self.assertEquals(set(os.listdir(os.path.join(self.dest, "nested"))), set())
self.assertEquals(set(os.listdir(os.path.join(self.dest, "a"))), {"c"})
self.assertEquals(set(os.listdir(os.path.join(self.dest, "a"))), {"c"})
self.assertEqual(set(os.listdir(self.dest)), {"nested", "a"})
self.assertEqual(set(os.listdir(os.path.join(self.dest, "nested"))), set())
self.assertEqual(set(os.listdir(os.path.join(self.dest, "a"))), {"c"})
self.assertEqual(set(os.listdir(os.path.join(self.dest, "a"))), {"c"})


def file(*args):
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/workflows/java_gradle/test_java_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def test_listdir(self):
names = ["a", "b", "c"]
for n in names:
self.new_file(self.src, n)
self.assertEquals(set(names), set(self.os_utils.listdir(self.src)))
self.assertEqual(set(names), set(self.os_utils.listdir(self.src)))

def test_copy(self):
f = self.new_file(self.src, "a")
expected = os.path.join(self.dst, "a")
copy_ret = self.os_utils.copy(f, expected)
self.assertEquals(expected, copy_ret)
self.assertEqual(expected, copy_ret)
self.assertTrue("a" in os.listdir(self.dst))

def test_exists(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/workflows/java_maven/test_java_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def test_listdir(self):
names = ["a", "b", "c"]
for n in names:
self.new_file(self.src, n)
self.assertEquals(set(names), set(self.os_utils.listdir(self.src)))
self.assertEqual(set(names), set(self.os_utils.listdir(self.src)))

def test_copy(self):
f = self.new_file(self.src, "a")
expected = os.path.join(self.dst, "a")
copy_ret = self.os_utils.copy(f, expected)
self.assertEquals(expected, copy_ret)
self.assertEqual(expected, copy_ret)
self.assertTrue("a" in os.listdir(self.dst))

def test_exists(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/workflows/custom_make/test_custom_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_must_build_python_project_through_makefile(self):
"chardet",
"urllib3",
"idna",
"urllib3-1.25.10.dist-info",
"urllib3-1.25.11.dist-info",
"chardet-3.0.4.dist-info",
"certifi-2020.4.5.2.dist-info",
"certifi",
Expand All @@ -55,7 +55,7 @@ def test_must_build_python_project_through_makefile(self):

expected_files = self.test_data_files.union(dependencies_installed)
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_must_build_python_project_through_makefile_unknown_target(self):
with self.assertRaises(WorkflowFailedError):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_with_defaults_file(self):

output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_require_parameters(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "RequireParameters")
Expand All @@ -66,4 +66,4 @@ def test_require_parameters(self):

output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)
8 changes: 4 additions & 4 deletions tests/integration/workflows/go_dep/test_go_dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_builds_project_with_no_deps(self):
expected_files = {"main"}
output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_and_excludes_hidden_aws_sam(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "src", "excluded-files")
Expand All @@ -59,7 +59,7 @@ def test_builds_project_and_excludes_hidden_aws_sam(self):
expected_files = {"main"}
output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_with_no_gopkg_file(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "src", "no-gopkg")
Expand All @@ -74,7 +74,7 @@ def test_builds_project_with_no_gopkg_file(self):
options={"artifact_executable_name": "main"},
)

self.assertEquals(
self.assertEqual(
"GoDepBuilder:DepEnsure - Exec Failed: could not find project Gopkg.toml,"
+ " use dep init to initiate a manifest",
str(ex.exception),
Expand All @@ -95,7 +95,7 @@ def test_builds_project_with_remote_deps(self):
expected_files = {"main"}
output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_with_failed_remote_deps(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "src", "failed-remote")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/workflows/go_modules/test_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_builds_project_without_dependencies(self):
expected_files = {"no-deps-main"}
output_files = set(os.listdir(self.artifacts_dir))
print(output_files)
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_with_dependencies(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps")
Expand All @@ -52,7 +52,7 @@ def test_builds_project_with_dependencies(self):
)
expected_files = {"with-deps-main"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_fails_if_modules_cannot_resolve_dependencies(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "broken-deps")
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/workflows/nodejs_npm/test_nodejs_npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_builds_project_without_dependencies(self):

expected_files = {"package.json", "included.js"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_and_excludes_hidden_aws_sam(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "excluded-files")
Expand All @@ -56,7 +56,7 @@ def test_builds_project_and_excludes_hidden_aws_sam(self):

expected_files = {"package.json", "included.js"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_with_remote_dependencies(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npm-deps")
Expand All @@ -71,11 +71,11 @@ def test_builds_project_with_remote_dependencies(self):

expected_files = {"package.json", "included.js", "node_modules"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

expected_modules = {"minimal-request-promise"}
output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules")))
self.assertEquals(expected_modules, output_modules)
self.assertEqual(expected_modules, output_modules)

def test_builds_project_with_npmrc(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "npmrc")
Expand All @@ -91,11 +91,11 @@ def test_builds_project_with_npmrc(self):
expected_files = {"package.json", "included.js", "node_modules"}
output_files = set(os.listdir(self.artifacts_dir))

self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

expected_modules = {"fake-http-request"}
output_modules = set(os.listdir(os.path.join(self.artifacts_dir, "node_modules")))
self.assertEquals(expected_modules, output_modules)
self.assertEqual(expected_modules, output_modules)

def test_fails_if_npm_cannot_resolve_dependencies(self):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_must_build_python_project(self):
else:
expected_files = self.test_data_files.union({"numpy", "numpy-1.17.4.dist-info"})
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_mismatch_runtime_python_project(self):
# NOTE : Build still works if other versions of python are accessible on the path. eg: /usr/bin/python2.7
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/workflows/ruby_bundler/test_ruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_builds_project_without_dependencies(self):
)
expected_files = {"handler.rb", "Gemfile", "Gemfile.lock", ".bundle", "vendor"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_with_dependencies(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "with-deps")
Expand All @@ -42,7 +42,7 @@ def test_builds_project_with_dependencies(self):
)
expected_files = {"handler.rb", "Gemfile", "Gemfile.lock", ".bundle", "vendor"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_builds_project_and_ignores_excluded_files(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "excluded-files")
Expand All @@ -51,7 +51,7 @@ def test_builds_project_and_ignores_excluded_files(self):
)
expected_files = {"handler.rb", "Gemfile", "Gemfile.lock", ".bundle", "vendor"}
output_files = set(os.listdir(self.artifacts_dir))
self.assertEquals(expected_files, output_files)
self.assertEqual(expected_files, output_files)

def test_fails_if_bundler_cannot_resolve_dependencies(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "broken-deps")
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_must_load_all_default_workflows(self, get_workflow_mock, importlib_mock
# instantiate
builder = LambdaBuilder(self.lang, self.lang_framework, self.app_framework)

self.assertEquals(builder.supported_workflows, [self.DEFAULT_WORKFLOW_MODULE])
self.assertEqual(builder.supported_workflows, [self.DEFAULT_WORKFLOW_MODULE])

# First check if the module was loaded
importlib_mock.import_module.assert_called_once_with(self.DEFAULT_WORKFLOW_MODULE)
Expand All @@ -44,7 +44,7 @@ def test_must_support_loading_custom_workflows(self, get_workflow_mock, importli
# instantiate
builder = LambdaBuilder(self.lang, self.lang_framework, self.app_framework, supported_workflows=modules)

self.assertEquals(builder.supported_workflows, modules)
self.assertEqual(builder.supported_workflows, modules)

# Make sure the modules are loaded in same order as passed
importlib_mock.import_module.assert_has_calls([call(m) for m in modules], any_order=False)
Expand All @@ -56,7 +56,7 @@ def test_must_not_load_any_workflows(self, get_workflow_mock, importlib_mock):
modules = [] # Load no modules
builder = LambdaBuilder(self.lang, self.lang_framework, self.app_framework, supported_workflows=modules)

self.assertEquals(builder.supported_workflows, [])
self.assertEqual(builder.supported_workflows, [])

# Make sure the modules are loaded in same order as passed
importlib_mock.import_module.assert_not_called()
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_path_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def setUp(self):
self.path_resolver = PathResolver(runtime="chitti2.0", binary="chitti")

def test_inits(self):
self.assertEquals(self.path_resolver.runtime, "chitti2.0")
self.assertEquals(self.path_resolver.binary, "chitti")
self.assertEqual(self.path_resolver.runtime, "chitti2.0")
self.assertEqual(self.path_resolver.binary, "chitti")

def test_which_fails(self):
with self.assertRaises(ValueError):
Expand All @@ -23,4 +23,4 @@ def test_which_fails(self):
def test_which_success_immediate(self):
with mock.patch.object(self.path_resolver, "_which") as which_mock:
which_mock.return_value = os.getcwd()
self.assertEquals(self.path_resolver.exec_paths, os.getcwd())
self.assertEqual(self.path_resolver.exec_paths, os.getcwd())
Loading