Skip to content

Commit 2c06c76

Browse files
monkutstorkwranglerCopilot
authored
🔥 remove *kappa* usage, replacing with similar internal representation (#1386)
* 🔥 remove *kappa* usage, replacing with similar internal representation. 🔧 Add type annotations (to fix pre-commit issues) * ✅ updated to address failing testcase * 🔧 update to use pathlib Path objects in-place of strings * 🔧 ✅ align test cases file names from test*/tests* -> test_*, change tests.py -> test_core.py 🔧 update Makefile to reflect changes in test filenames. * 🔧 revert back unnecessary typing of test settings.py files. 🔥 remove unused test_async_old.py file. * 🔧 replace os.path usage with Path usage * 🔥 🔧 removing unnecessary str() conversion of pathlib objects when using shutil. * 🔥 🔧 replace print() statements with logger. 🔧 add types where unclear * Update zappa/core.py Co-authored-by: Copilot <[email protected]> * 🔥 remove unnecessary func introduction --------- Co-authored-by: shane <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 61c50c8 commit 2c06c76

14 files changed

+688
-524
lines changed

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,39 +58,39 @@ flake:
5858
flake8 zappa --count --exit-zero --max-complexity=55 --max-line-length=127 --statistics --ignore F403,F405,E203,E231,E252,W503
5959

6060
test-docs:
61-
pytest tests/tests_docs.py --cov=zappa --durations=0
61+
pytest tests/test_docs.py --cov=zappa --durations=0
6262

6363
test-handler:
6464
pytest tests/test_handler.py --cov=zappa --durations=0
6565

6666
test-middleware:
67-
pytest tests/tests_middleware.py --cov=zappa --durations=0
67+
pytest tests/test_middleware.py --cov=zappa --durations=0
6868

6969
test-placebo:
70-
pytest tests/tests_placebo.py --cov=zappa --durations=0
70+
pytest tests/test_placebo.py --cov=zappa --durations=0
7171

7272
test-async:
73-
pytest tests/tests_async.py --cov=zappa --durations=0
73+
pytest tests/test_async.py --cov=zappa --durations=0
7474

7575
test-general:
76-
pytest tests/tests.py --cov=zappa --durations=0
76+
pytest tests/test_core.py --cov=zappa --durations=0
7777

7878
test-utilities:
79-
pytest tests/tests_utilities.py --cov=zappa --durations=0
79+
pytest tests/test_utilities.py --cov=zappa --durations=0
8080

8181
coverage-report:
8282
coverage report --include="*/zappa*"
8383

8484
tests:
8585
make clean
8686
pytest \
87-
tests/tests_docs.py \
87+
tests/test_docs.py \
8888
tests/test_handler.py \
89-
tests/tests_middleware.py \
90-
tests/tests_placebo.py \
91-
tests/tests_async.py \
92-
tests/tests.py \
93-
tests/tests_utilities.py \
89+
tests/test_middleware.py \
90+
tests/test_placebo.py \
91+
tests/test_async.py \
92+
tests/test_core.py \
93+
tests/test_utilities.py \
9494
--cov=zappa \
9595
--cov-report=xml \
9696
--durations=0

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ boto3 = ">=1.17.28"
2626
durationpy = "*"
2727
hjson = "*"
2828
jmespath = "*"
29-
kappa = "==0.6.0"
3029
pip = ">=24.0.0"
3130
placebo = "<0.10"
3231
python-dateutil = "*"
File renamed without changes.

tests/tests.py renamed to tests/test_core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import re
99
import shutil
1010
import string
11-
import subprocess
1211
import sys
1312
import tempfile
1413
import unittest
@@ -24,7 +23,6 @@
2423
import botocore.stub
2524
import flask
2625
import mock
27-
import pytest
2826
from click.exceptions import ClickException
2927
from click.globals import resolve_color_default
3028
from packaging import version
File renamed without changes.

tests/test_event_script_app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
def handler_for_events(event, context):
1+
from typing import Any
2+
3+
4+
def handler_for_events(event: Any, context: Any) -> bool:
25
print("Event:", event)
36
return True

tests/test_handler.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
from typing import Any, Tuple
23

34
from mock import Mock
45

@@ -8,35 +9,35 @@
89
from .utils import is_base64
910

1011

11-
def no_args():
12+
def no_args() -> None:
1213
return
1314

1415

15-
def one_arg(first):
16+
def one_arg(first: Any) -> Any:
1617
return first
1718

1819

19-
def two_args(first, second):
20+
def two_args(first: Any, second: Any) -> Tuple[Any, Any]:
2021
return first, second
2122

2223

23-
def var_args(*args):
24+
def var_args(*args: Any) -> Tuple[Any, ...]:
2425
return args
2526

2627

27-
def var_args_with_one(first, *args):
28+
def var_args_with_one(first: Any, *args: Any) -> Tuple[Any, Any]:
2829
return first, args[0]
2930

3031

31-
def unsupported(first, second, third):
32+
def unsupported(first: Any, second: Any, third: Any) -> Tuple[Any, Any, Any]:
3233
return first, second, third
3334

3435

35-
def raises_exception(*args, **kwargs):
36+
def raises_exception(*args: Any, **kwargs: Any) -> None:
3637
raise Exception("app exception")
3738

3839

39-
def handle_bot_intent(event, context):
40+
def handle_bot_intent(event: Any, context: Any) -> str:
4041
return "Success"
4142

4243

File renamed without changes.
File renamed without changes.

tests/tests_utilities.py renamed to tests/test_utilities.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import os
33
import re
4-
import shutil
54
import tempfile
65
import unittest
76
from pathlib import Path
@@ -79,8 +78,8 @@ def test_copy_editable_packages(self, mock_find_packages):
7978
# are copied to the temp package directory
8079
# find_packages() is called on the egg_path to find the packages
8180
mock_copytree.assert_called_with(
82-
os.path.join(egg_path, "package"),
83-
os.path.join(temp_package_dir, "package"),
81+
Path(egg_path) / "package",
82+
temp_package_dir / "package",
8483
metadata=False,
8584
symlinks=False,
8685
)

0 commit comments

Comments
 (0)