Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove py3.7 test runs #9

Merged
merged 10 commits into from
Jul 18, 2020
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()