本文整理汇总了Python中ufora.config.Setup.defaultSetup方法的典型用法代码示例。如果您正苦于以下问题:Python Setup.defaultSetup方法的具体用法?Python Setup.defaultSetup怎么用?Python Setup.defaultSetup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ufora.config.Setup
的用法示例。
在下文中一共展示了Setup.defaultSetup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UserFacingMainline
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
def UserFacingMainline(main, argv, modulesToInitialize=None, parser=None):
"""Helper function that initializes some modules and then calls main.
Used to centralize error handling for common initialization routines and to set up the
initial component hosts.
"""
if parser is None:
parser = Setup.defaultParser()
setup = Setup.defaultSetup()
parsedArguments = parser.parse_args(argv[1:])
setup.processArgs(parsedArguments)
setup.config.configureLoggingForUserProgram()
with Setup.PushSetup(setup):
initializeModules(modulesToInitialize)
result = main(parsedArguments)
if result is None:
result = 0
sys.stdout.flush()
sys.stderr.flush()
os._exit(result)
示例2: main
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
def main(argv):
t0 = time.time()
Runtime.initialize(Setup.defaultSetup())
runtime = Runtime.getMainRuntime()
handler = runtime.getInterpreterTraceHandler()
handler.replayTracesFromFile(argv[1])
print "took ", time.time() - t0
示例3: executeTestAsMain
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
def executeTestAsMain():
with Setup.PushSetup(Setup.defaultSetup()):
#tests = ['testKeys', 'testMutableDefaults', 'testProperty', 'testChangeMutable', 'testLocationAccess', 'testFunction', 'testInitializer', 'testCached', 'testNotCached', 'testRootProperty']
#tests = ['testProperty']
tests = ['testTemp']
#tests = ['testOrphan']
#tests = ['testLocKey2']
#tests = ['testKeys']
#tests = ['testCreate']
suite = unittest.TestSuite(map(ComputedGraphTest, tests))
unittest.TextTestRunner().run(suite)
示例4: set
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
for filename in foraFiles:
foraModule = FORA.importModule(os.path.join(testPath, filename))
moduleMembersAndMetadataDict = FORA.objectMembers(foraModule)
for memberName, memberMetadata in moduleMembersAndMetadataDict.iteritems():
if self.isPerfTestCase(memberMetadata):
if filename not in perfTestCases:
perfTestCases[filename] = set()
perfTestCases[filename].add(memberName)
metadataForPerfTestCases[(filename, memberName)] = memberMetadata.outer
return perfTestCases, metadataForPerfTestCases
if __name__ == "__main__":
setup = Setup.defaultSetup()
with Setup.PushSetup(setup):
Setup.config().configureLoggingForUserProgram()
FORA.initialize()
langfilter = None
listOnly = False
try:
result = test()
except:
logging.critical(traceback.format_exc())
result = 1
示例5: open
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
rebuildAxiomSearchFunction
Generate appropriate axiom build functions after we've built the project successfully.
"""
import os
import ufora
import ufora.config.Setup as Setup
import ufora.FORA.python.Runtime as Runtime
Runtime.initialize(Setup.defaultSetup())
axioms = Runtime.getMainRuntime().getAxioms()
implvalCode, jovtCode = axioms.getCppWrapperCode()
uforaDir = os.path.split(os.path.abspath(ufora.__file__))[0]
with open(os.path.join(uforaDir, "FORA", "Axioms", "AxiomSearch.cpp"), "w") as f:
print >> f, "//generated by ufora/scripts/rebuildAxiomSearchFunction.py"
print >> f, implvalCode
with open(os.path.join(uforaDir, "FORA", "Axioms", "AxiomSearch2.cpp"), "w") as f:
print >> f, "//generated by ufora/scripts/rebuildAxiomSearchFunction.py"
print >> f, jovtCode
示例6: UnitTestMainline
# 需要导入模块: from ufora.config import Setup [as 别名]
# 或者: from ufora.config.Setup import defaultSetup [as 别名]
def UnitTestMainline(modulesToInitialize=None,
exit=True,
loginConfiguration=LoginConfiguration.LoginConfiguration.defaultForTesting(),
disableLogCapture=False):
"""Helper function to call the unittest mainline
Constructs a default Setup from the config. Calls
x.initialize(setup)
for all x in modulesToInitialize.
"""
modulesToInitialize = modulesToInitialize or []
import ufora.native
argv = list(sys.argv)
setup = Setup.defaultSetup()
parser = Setup.defaultParser()
unitTestOptions = parser.add_argument_group(
title='UnitTestMainline options',
description='options for the general UnitTest framework'
)
addNoseVerbosityArgument(unitTestOptions)
unitTestOptions.add_argument(
'testHarnessArguments',
nargs=argparse.REMAINDER
)
parser.add_argument('-timeout',
type=float,
nargs=1,
help='fail test if not completed after TIMEOUT seconds',
default=None)
parsedArguments = parser.parse_args(argv[1:])
if parsedArguments.timeout is not None:
UnitTestCommon.startTimeoutThread(parsedArguments.timeout[0])
setup.processArgs(parsedArguments)
testHarnessArguments = ["dummy"] + parsedArguments.testHarnessArguments
testHarnessArguments.append('--verbosity=0')
if parsedArguments.testHarnessVerbose or disableLogCapture:
testHarnessArguments.append('--nocaptureall')
setup.config.configureLoggingForUserProgram()
plugins = nose.plugins.manager.PluginManager([OutputCaptureNosePlugin()])
config = nose.config.Config(plugins=plugins)
config.configure(testHarnessArguments)
with Setup.PushSetup(setup):
result = None
for toInitialize in modulesToInitialize:
toInitialize.initialize(setup)
result = nose.core.TestProgram(
exit=False,
defaultTest="__main__",
config=config,
argv=testHarnessArguments
).success
sys.stdout.flush()
sys.stderr.flush()
ufora.native.Tests.gcov_flush()
if not exit:
return 0 if result else 1
else:
os._exit(0 if result else 1)