Skip to content

Commit 4bd58a5

Browse files
committed
Added unit tests
1 parent 5244055 commit 4bd58a5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/unittests/test_utilities_dependency.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def test_prioritize_customer_dependencies_from_working_directory(self):
608608
os.path.join(self._customer_func_path, 'func_specific_module')
609609
)
610610

611-
def test_reload_customer_libraries(self):
611+
def test_reload_customer_libraries_dependency_isolation_true(self):
612612
os.environ['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] = 'true'
613613
# Setup paths
614614
DependencyManager.worker_deps_path = self._worker_deps_path
@@ -621,6 +621,23 @@ def test_reload_customer_libraries(self):
621621
common_module.package_location,
622622
os.path.join(self._customer_deps_path, 'common_module'))
623623

624+
def test_reload_customer_libraries_dependency_isolation_false(self):
625+
os.environ['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] = 'false'
626+
# Setup paths
627+
DependencyManager.worker_deps_path = self._worker_deps_path
628+
DependencyManager.cx_deps_path = self._customer_deps_path
629+
DependencyManager.cx_working_dir = self._customer_func_path
630+
631+
DependencyManager._add_to_sys_path(self._worker_deps_path, True)
632+
import azure.functions # NoQA
633+
634+
DependencyManager._add_to_sys_path(self._customer_deps_path, True)
635+
DependencyManager.reload_customer_libraries(self._customer_deps_path)
636+
# Checking if azure.functions gets reloaded
637+
self.assertIn(
638+
os.path.join(self._customer_deps_path, 'azure', 'functions'),
639+
sys.modules['azure.functions'].__path__)
640+
624641
def test_remove_module_cache(self):
625642
# First import the common_module and create a sys.modules cache
626643
sys.path.append(self._customer_deps_path)

0 commit comments

Comments
 (0)