Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def runtest(self):
"""Run an AnyScript test item."""
tmpdir = Path(
TempdirFactory(TempPathFactory.from_config(self.config)).mktemp(self.name)
)
with change_dir(tmpdir):
self.app = AnyPyProcess(**self.app_opts)
result = self.app.start_macro(self.macro)[0]
# Ignore error due to missing Main.RunTest
if "ERROR" in result:
runtest_missing = any(
"Error : Main.RunTest :" in err for err in result["ERROR"]
)
if runtest_missing:
runtest_errros = (
"Error : Main.RunTest : Unresolved",
"Main.RunTest : Select Operation",
"Error : run : command unexpected while",
)
result["ERROR"][:] = [
err
for err in result["ERROR"]
app.start_macro(default_macro)
app.save_to_hdf5('test.hdf5', 'LungeTLEM1')
assert(os.path.exists('test.hdf5'))
if __name__ == '__main__':
macro = [['load "Demo.Arm2D.any"',
'operation Main.ArmModelStudy.InverseDynamics',
'run',
'classoperation Main.ArmModelStudy.Output.MaxMuscleActivity "Dump"',
'classoperation Main.ArmModel.GlobalRef.t "Dump"'
]]*5
app = AnyPyProcess(keep_logfiles=True)
app.start_macro(macro)
app.save_to_hdf5('test2.hdf5', 'Lunge11dec')
def test_hdf5save(tmpdir, default_macro):
setup_simple_model( tmpdir )
tmpdir.chdir()
app = AnyPyProcess(keep_logfiles=True)
app.start_macro(default_macro)
app.save_to_hdf5('test.hdf5', 'LungeTLEM1')
assert(os.path.exists('test.hdf5'))
from anypytools import AnyPyProcess
from anypytools.macro_commands import Load, OperationRun
app = AnyPyProcess(num_processes = 3)
macro = [Load("main.any"),
OperationRun('Main.Study.InverseDynamics') ]
app.start_macro(macro, search_subdirs= "model[1-9].*main.any" )