Skip to content

Commit 4b9f126

Browse files
authored
More updates for Debian Trixie compilation (#310)
Signed-off-by: Saikrishna Arcot <[email protected]>
1 parent c9b79dc commit 4b9f126

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/gnoi_reset_test.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for gnoi_reset."""
22

3-
import imp
3+
import importlib.util
4+
import importlib.machinery
45
import os
56
import sys
67
import logging
@@ -21,8 +22,19 @@
2122
RETAIN_CERTS_REQUEST = '{"factory_os": true, "retainCerts": true}'
2223
INVALID_RESET_REQUEST = '"factory_os": true, "zero_fill": true'
2324

24-
imp.load_source("host_service", host_modules_path + "/host_service.py")
25-
imp.load_source("gnoi_reset", host_modules_path + "/gnoi_reset.py")
25+
26+
def load_source(modname, filename):
27+
loader = importlib.machinery.SourceFileLoader(modname, filename)
28+
spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
29+
module = importlib.util.module_from_spec(spec)
30+
# The module is always executed and not cached in sys.modules.
31+
# Uncomment the following line to cache the module.
32+
sys.modules[module.__name__] = module
33+
loader.exec_module(module)
34+
return module
35+
36+
load_source("host_service", host_modules_path + "/host_service.py")
37+
load_source("gnoi_reset", host_modules_path + "/gnoi_reset.py")
2638
from gnoi_reset import *
2739

2840

0 commit comments

Comments
 (0)