Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3792871
D1703.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D1703.diff
View Options
diff --git a/_tests/modules/test_forest.py b/_tests/modules/test_forest.py
--- a/_tests/modules/test_forest.py
+++ b/_tests/modules/test_forest.py
@@ -1,9 +1,9 @@
-import imp
+from importlib.machinery import SourceFileLoader
import unittest
-salt_test_case = imp.load_source('salt_test_case', "salt_test_case.py")
-forest = imp.load_source('forest', "../_modules/forest.py")
+salt_test_case = SourceFileLoader('salt_test_case', "salt_test_case.py").load_module()
+forest = SourceFileLoader('forest', "../_modules/forest.py").load_module()
class Testinstance(unittest.TestCase, salt_test_case.SaltTestCase):
diff --git a/_tests/modules/test_jails.py b/_tests/modules/test_jails.py
--- a/_tests/modules/test_jails.py
+++ b/_tests/modules/test_jails.py
@@ -1,9 +1,9 @@
-import imp
+from importlib.machinery import SourceFileLoader
import unittest
-salt_test_case = imp.load_source('salt_test_case', "salt_test_case.py")
-jails = imp.load_source('jails', "../_modules/jails.py")
+salt_test_case = SourceFileLoader('salt_test_case', "salt_test_case.py").load_module()
+jails = SourceFileLoader('jails', "../_modules/jails.py").load_module()
class Testinstance(unittest.TestCase, salt_test_case.SaltTestCase):
diff --git a/_tests/modules/test_node.py b/_tests/modules/test_node.py
--- a/_tests/modules/test_node.py
+++ b/_tests/modules/test_node.py
@@ -1,9 +1,9 @@
-import imp
+from importlib.machinery import SourceFileLoader
import unittest
-salt_test_case = imp.load_source('salt_test_case', "salt_test_case.py")
-node = imp.load_source('node', "../_modules/node.py")
+salt_test_case = SourceFileLoader('salt_test_case', "salt_test_case.py").load_module()
+node = SourceFileLoader('node', "../_modules/node.py").load_module()
class Testinstance(unittest.TestCase, salt_test_case.SaltTestCase):
diff --git a/_tests/salt_test_case.py b/_tests/salt_test_case.py
--- a/_tests/salt_test_case.py
+++ b/_tests/salt_test_case.py
@@ -1,11 +1,11 @@
-import imp
+from importlib.machinery import SourceFileLoader
import yaml
class SaltTestCase:
def initialize_mocks(self):
- source = imp.load_source('dunder', "mocks/dunder.py")
+ source = SourceFileLoader("dunder", "mocks/dunder.py").load_module()
self.pillar = source.dunder()
self.grains = source.dunder()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 18:41 (21 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2269666
Default Alt Text
D1703.diff (2 KB)
Attached To
Mode
D1703: Supersede imp module by importlib
Attached
Detach File
Event Timeline
Log In to Comment