Skip to content

Commit 8b8cb4a

Browse files
committed
Add synthetic recursion tests
1 parent af204b5 commit 8b8cb4a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

aikido_zen/sinks/tests/builtins_import_test.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,33 @@ def test_django_import():
2222
import django
2323

2424
assert PackagesStore.get_package("django")["version"] == "4.0"
25+
26+
27+
def recursive_get_package(name):
28+
"""Recursively add package and its dependencies to PackagesStore."""
29+
import flask
30+
31+
32+
def test_recursive_package_store(monkeypatch):
33+
PackagesStore.clear()
34+
monkeypatch.setattr(PackagesStore, "get_package", recursive_get_package)
35+
36+
import flask
37+
38+
# Restore the original method after the test
39+
monkeypatch.undo()
40+
41+
42+
def recursive_add_package(name, version):
43+
"""Recursively add package and its dependencies to PackagesStore."""
44+
if name == "django":
45+
import django
46+
47+
48+
def test_recursive_package_store_2(monkeypatch):
49+
PackagesStore.clear()
50+
monkeypatch.setattr(PackagesStore, "add_package", recursive_add_package)
51+
import django
52+
53+
# Restore the original method after the test
54+
monkeypatch.undo()

0 commit comments

Comments
 (0)