Skip to content

Commit

Permalink
Merge pull request #9 from alexkosj/fix-tests
Browse files Browse the repository at this point in the history
remove py3.7 test runs
  • Loading branch information
alexkosj committed Jul 18, 2020
2 parents e879adf + 9c77a41 commit 3994bac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.8]

steps:
- uses: actions/checkout@v2
Expand Down
24 changes: 18 additions & 6 deletions tests/test_pruun.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os.path
import os
import subprocess

from click.testing import CliRunner
Expand All @@ -11,29 +11,41 @@ def test_deployment_package():
Test parsing of installed packages, creation of .zip, and finally validate integrity of .zip.
"""
runner = CliRunner()
lambda_file_name = "handler.py"
package_name = "deployment_package.zip"

with runner.isolated_filesystem():
with open("handler.py", "w") as f: # create dummy lambda handler file
with open(lambda_file_name, "w") as f: # create dummy lambda handler file
pass

result = runner.invoke(pruun, ["package", "handler.py"])
result = runner.invoke(pruun, ["package", lambda_file_name])

# check for no exceptions
assert result.exit_code == 0

# check for existence of .zip file
assert os.path.isfile("deployment_package.zip") == True
assert os.path.isfile(package_name) == True

# verify integrity of .zip
depens = get_dependency_names()
for depen in depens:
underscored_name = depen.replace("-", "_").strip()
cmd = f"unzip -l deployment_package.zip {underscored_name}*"
cmd = f"unzip -l {package_name} {underscored_name}*"
subprocess.run(
cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
shell=True,
check=True,
)
) # check .zip for all installed packages

cmd = f"unzip -l {package_name} {lambda_file_name}*"
subprocess.run(
cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
shell=True,
check=True,
) # check .zip for lambda handler file

f.close()

0 comments on commit 3994bac

Please sign in to comment.