MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / load_from_path

Method load_from_path

tests/lit/lit/TestingConfig.py:117–156  ·  view source on GitHub ↗

load_from_path(path, litConfig) Load the configuration module at the provided path into the given config object.

(self, path, litConfig)

Source from the content-addressed store, hash-verified

115 )
116
117 def load_from_path(self, path, litConfig):
118 """
119 load_from_path(path, litConfig)
120
121 Load the configuration module at the provided path into the given config
122 object.
123 """
124
125 # Load the config script data.
126 data = None
127 f = open(path)
128 try:
129 data = f.read()
130 except:
131 litConfig.fatal("unable to load config file: %r" % (path,))
132 f.close()
133
134 # Execute the config script to initialize the object.
135 cfg_globals = dict(globals())
136 cfg_globals["config"] = self
137 cfg_globals["lit_config"] = litConfig
138 cfg_globals["__file__"] = path
139 try:
140 exec(compile(data, path, "exec"), cfg_globals, None)
141 if litConfig.debug:
142 litConfig.note("... loaded config %r" % path)
143 except SystemExit:
144 e = sys.exc_info()[1]
145 # We allow normal system exit inside a config file to just
146 # return control without error.
147 if e.args:
148 raise
149 except:
150 import traceback
151
152 litConfig.fatal(
153 "unable to parse config file %r, traceback: %s"
154 % (path, traceback.format_exc())
155 )
156 self.finish(litConfig)
157
158 def __init__(
159 self,

Callers 2

search1Function · 0.80
load_configMethod · 0.80

Calls 4

finishMethod · 0.95
execFunction · 0.85
fatalMethod · 0.80
noteMethod · 0.80

Tested by

no test coverage detected