File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 11"""Tests for gnoi_reset."""
22
3- import imp
3+ import importlib .util
4+ import importlib .machinery
45import os
56import sys
67import logging
2122RETAIN_CERTS_REQUEST = '{"factory_os": true, "retainCerts": true}'
2223INVALID_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" )
2638from gnoi_reset import *
2739
2840
You can’t perform that action at this time.
0 commit comments