Skip to content

Commit 450fe63

Browse files
committed
Unit test fixes
1 parent 37d07da commit 450fe63

File tree

2 files changed

+4
-74
lines changed

2 files changed

+4
-74
lines changed

tests/unittests/test_rpc_messages.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,7 @@ def test_failed_azure_namespace_import(self):
127127

128128
@unittest.skipIf(sys.platform == 'win32',
129129
'Linux .sh script only works on Linux')
130-
@unittest.skipIf(
131-
is_python_version('3.10'),
132-
'In Python 3.10, isolate worker dependencies is turned on by default.'
133-
' Reloading all customer dependencies on specialization is a must.'
134-
' This partially reloading namespace feature is no longer needed.'
135-
)
136130
def test_successful_azure_namespace_import(self):
137131
self._verify_azure_namespace_import(
138132
'true',
139-
'module_b is imported')
133+
'module_b fails to import')

tests/unittests/test_utilities_dependency.py

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_add_to_sys_path_no_duplication(self):
229229

230230
def test_add_to_sys_path_import_module(self):
231231
DependencyManager._add_to_sys_path(self._customer_deps_path, True)
232-
import common_module # NoQA
232+
import common_module # NoQA
233233
self.assertEqual(
234234
common_module.package_location,
235235
os.path.join(self._customer_deps_path, 'common_module')
@@ -240,7 +240,7 @@ def test_add_to_sys_path_import_namespace_path(self):
240240
into sys.path
241241
"""
242242
DependencyManager._add_to_sys_path(self._customer_deps_path, True)
243-
import common_namespace # NoQA
243+
import common_namespace # NoQA
244244
self.assertEqual(len(common_namespace.__path__), 1)
245245
self.assertEqual(
246246
common_namespace.__path__[0],
@@ -517,7 +517,7 @@ def test_clear_path_importer_cache_and_modules_retain_namespace(self):
517517
sys.path.insert(0, self._worker_deps_path)
518518

519519
# Ensure new import is from _worker_deps_path
520-
import common_module as worker_mod # NoQA
520+
import common_module as worker_mod # NoQA
521521
self.assertIn('common_module', sys.modules)
522522
self.assertEqual(
523523
worker_mod.package_location,
@@ -555,39 +555,6 @@ def test_use_worker_dependencies_disable(self):
555555
with self.assertRaises(ImportError):
556556
import common_module # NoQA
557557

558-
@unittest.skipUnless(
559-
sys.version_info.major == 3 and sys.version_info.minor != 10,
560-
'Test only available for Python 3.6, 3.7, 3.8 or 3.9'
561-
)
562-
def test_use_worker_dependencies_default_python_36_37_38_39(self):
563-
# Feature should be disabled in Python 3.6, 3.7, 3.8 and 3.9
564-
# Setup paths
565-
DependencyManager.worker_deps_path = self._worker_deps_path
566-
DependencyManager.cx_deps_path = self._customer_deps_path
567-
DependencyManager.cx_working_dir = self._customer_func_path
568-
569-
# The common_module cannot be imported since feature is disabled
570-
DependencyManager.use_worker_dependencies()
571-
with self.assertRaises(ImportError):
572-
import common_module # NoQA
573-
574-
@unittest.skip('Skipping since PYTHON_ISOLATE_WORKER_DEPENDENCIES is '
575-
'disabled by default')
576-
def test_use_worker_dependencies_default_python_310(self):
577-
# Feature should be enabled in Python 3.10 by default
578-
# Setup paths
579-
DependencyManager.worker_deps_path = self._worker_deps_path
580-
DependencyManager.cx_deps_path = self._customer_deps_path
581-
DependencyManager.cx_working_dir = self._customer_func_path
582-
583-
# Ensure the common_module is imported from _worker_deps_path
584-
DependencyManager.use_worker_dependencies()
585-
import common_module # NoQA
586-
self.assertEqual(
587-
common_module.package_location,
588-
os.path.join(self._worker_deps_path, 'common_module')
589-
)
590-
591558
def test_prioritize_customer_dependencies(self):
592559
# Setup app settings
593560
os.environ['PYTHON_ISOLATE_WORKER_DEPENDENCIES'] = 'true'
@@ -626,37 +593,6 @@ def test_prioritize_customer_dependencies_disable(self):
626593
with self.assertRaises(ImportError):
627594
import common_module # NoQA
628595

629-
@unittest.skipIf(is_python_version('3.10'),
630-
'Test not available for python 3.10')
631-
def test_prioritize_customer_dependencies_default_python_36_37_38_39(self):
632-
# Feature should be disabled in Python 3.6, 3.7, 3.8 and 3.9
633-
# Setup paths
634-
DependencyManager.worker_deps_path = self._worker_deps_path
635-
DependencyManager.cx_deps_path = self._customer_deps_path
636-
DependencyManager.cx_working_dir = self._customer_func_path
637-
638-
# Ensure the common_module is imported from _customer_deps_path
639-
DependencyManager.prioritize_customer_dependencies()
640-
with self.assertRaises(ImportError):
641-
import common_module # NoQA
642-
643-
@unittest.skip('Skipping since PYTHON_ISOLATE_WORKER_DEPENDENCIES is '
644-
'disabled by default')
645-
def test_prioritize_customer_dependencies_default_python_310(self):
646-
# Feature should be enabled in Python 3.10 by default
647-
# Setup paths
648-
DependencyManager.worker_deps_path = self._worker_deps_path
649-
DependencyManager.cx_deps_path = self._customer_deps_path
650-
DependencyManager.cx_working_dir = self._customer_func_path
651-
652-
# Ensure the common_module is imported from _customer_deps_path
653-
DependencyManager.prioritize_customer_dependencies()
654-
import common_module # NoQA
655-
self.assertEqual(
656-
common_module.package_location,
657-
os.path.join(self._customer_deps_path, 'common_module')
658-
)
659-
660596
def test_prioritize_customer_dependencies_from_working_directory(self):
661597
self._initialize_scenario()
662598

0 commit comments

Comments
 (0)