Best Python code snippet using autotest_python
test_loader.py
Source:test_loader.py
...151 self.assertRaisesRegexp(TypeError, "some failure", test.m)152 153 ################################################################154 ### /Tests for TestLoader.loadTestsFromModule()155 ### Tests for TestLoader.loadTestsFromName()156 ################################################################157 # "The specifier name is a ``dotted name'' that may resolve either to158 # a module, a test case class, a TestSuite instance, a test method159 # within a test case class, or a callable object which returns a160 # TestCase or TestSuite instance."161 #162 # Is ValueError raised in response to an empty name?163 def test_loadTestsFromName__empty_name(self):164 loader = unittest2.TestLoader()165 try:166 loader.loadTestsFromName('')167 except ValueError, e:168 self.assertEqual(str(e), "Empty module name")169 else:170 self.fail("TestLoader.loadTestsFromName failed to raise ValueError")171 # "The specifier name is a ``dotted name'' that may resolve either to172 # a module, a test case class, a TestSuite instance, a test method173 # within a test case class, or a callable object which returns a174 # TestCase or TestSuite instance."175 #176 # What happens when the name contains invalid characters?177 def test_loadTestsFromName__malformed_name(self):178 loader = unittest2.TestLoader()179 # XXX Should this raise ValueError or ImportError?180 try:181 loader.loadTestsFromName('abc () //')182 except ValueError:183 pass184 except ImportError:185 pass186 else:187 self.fail("TestLoader.loadTestsFromName failed to raise ValueError")188 # "The specifier name is a ``dotted name'' that may resolve ... to a189 # module"190 #191 # What happens when a module by that name can't be found?192 def test_loadTestsFromName__unknown_module_name(self):193 loader = unittest2.TestLoader()194 try:195 loader.loadTestsFromName('sdasfasfasdf')196 except ImportError, e:197 self.assertEqual(str(e), "No module named sdasfasfasdf")198 else:199 self.fail("TestLoader.loadTestsFromName failed to raise ImportError")200 # "The specifier name is a ``dotted name'' that may resolve either to201 # a module, a test case class, a TestSuite instance, a test method202 # within a test case class, or a callable object which returns a203 # TestCase or TestSuite instance."204 #205 # What happens when the module is found, but the attribute can't?206 def test_loadTestsFromName__unknown_attr_name(self):207 loader = unittest2.TestLoader()208 try:209 loader.loadTestsFromName('unittest2.sdasfasfasdf')210 except AttributeError, e:211 self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")212 else:213 self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")214 # "The specifier name is a ``dotted name'' that may resolve either to215 # a module, a test case class, a TestSuite instance, a test method216 # within a test case class, or a callable object which returns a217 # TestCase or TestSuite instance."218 #219 # What happens when we provide the module, but the attribute can't be220 # found?221 def test_loadTestsFromName__relative_unknown_name(self):222 loader = unittest2.TestLoader()223 try:224 loader.loadTestsFromName('sdasfasfasdf', unittest2)225 except AttributeError, e:226 self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")227 else:228 self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")229 # "The specifier name is a ``dotted name'' that may resolve either to230 # a module, a test case class, a TestSuite instance, a test method231 # within a test case class, or a callable object which returns a232 # TestCase or TestSuite instance."233 # ...234 # "The method optionally resolves name relative to the given module"235 #236 # Does loadTestsFromName raise ValueError when passed an empty237 # name relative to a provided module?238 #239 # XXX Should probably raise a ValueError instead of an AttributeError240 def test_loadTestsFromName__relative_empty_name(self):241 loader = unittest2.TestLoader()242 try:243 loader.loadTestsFromName('', unittest2)244 except AttributeError:245 pass246 else:247 self.fail("Failed to raise AttributeError")248 # "The specifier name is a ``dotted name'' that may resolve either to249 # a module, a test case class, a TestSuite instance, a test method250 # within a test case class, or a callable object which returns a251 # TestCase or TestSuite instance."252 # ...253 # "The method optionally resolves name relative to the given module"254 #255 # What happens when an impossible name is given, relative to the provided256 # `module`?257 def test_loadTestsFromName__relative_malformed_name(self):258 loader = unittest2.TestLoader()259 # XXX Should this raise AttributeError or ValueError?260 try:261 loader.loadTestsFromName('abc () //', unittest2)262 except ValueError:263 pass264 except AttributeError:265 pass266 else:267 self.fail("TestLoader.loadTestsFromName failed to raise ValueError")268 # "The method optionally resolves name relative to the given module"269 #270 # Does loadTestsFromName raise TypeError when the `module` argument271 # isn't a module object?272 #273 # XXX Accepts the not-a-module object, ignorning the object's type274 # This should raise an exception or the method name should be changed275 #276 # XXX Some people are relying on this, so keep it for now277 def test_loadTestsFromName__relative_not_a_module(self):278 class MyTestCase(unittest2.TestCase):279 def test(self):280 pass281 class NotAModule(object):282 test_2 = MyTestCase283 loader = unittest2.TestLoader()284 suite = loader.loadTestsFromName('test_2', NotAModule)285 reference = [MyTestCase('test')]286 self.assertEqual(list(suite), reference)287 # "The specifier name is a ``dotted name'' that may resolve either to288 # a module, a test case class, a TestSuite instance, a test method289 # within a test case class, or a callable object which returns a290 # TestCase or TestSuite instance."291 #292 # Does it raise an exception if the name resolves to an invalid293 # object?294 def test_loadTestsFromName__relative_bad_object(self):295 m = types.ModuleType('m')296 m.testcase_1 = object()297 loader = unittest2.TestLoader()298 try:299 loader.loadTestsFromName('testcase_1', m)300 except TypeError:301 pass302 else:303 self.fail("Should have raised TypeError")304 # "The specifier name is a ``dotted name'' that may305 # resolve either to ... a test case class"306 def test_loadTestsFromName__relative_TestCase_subclass(self):307 m = types.ModuleType('m')308 class MyTestCase(unittest2.TestCase):309 def test(self):310 pass311 m.testcase_1 = MyTestCase312 loader = unittest2.TestLoader()313 suite = loader.loadTestsFromName('testcase_1', m)314 self.assertIsInstance(suite, loader.suiteClass)315 self.assertEqual(list(suite), [MyTestCase('test')])316 # "The specifier name is a ``dotted name'' that may resolve either to317 # a module, a test case class, a TestSuite instance, a test method318 # within a test case class, or a callable object which returns a319 # TestCase or TestSuite instance."320 def test_loadTestsFromName__relative_TestSuite(self):321 m = types.ModuleType('m')322 class MyTestCase(unittest2.TestCase):323 def test(self):324 pass325 m.testsuite = unittest2.TestSuite([MyTestCase('test')])326 loader = unittest2.TestLoader()327 suite = loader.loadTestsFromName('testsuite', m)328 self.assertIsInstance(suite, loader.suiteClass)329 self.assertEqual(list(suite), [MyTestCase('test')])330 # "The specifier name is a ``dotted name'' that may resolve ... to331 # ... a test method within a test case class"332 def test_loadTestsFromName__relative_testmethod(self):333 m = types.ModuleType('m')334 class MyTestCase(unittest2.TestCase):335 def test(self):336 pass337 m.testcase_1 = MyTestCase338 loader = unittest2.TestLoader()339 suite = loader.loadTestsFromName('testcase_1.test', m)340 self.assertIsInstance(suite, loader.suiteClass)341 self.assertEqual(list(suite), [MyTestCase('test')])342 # "The specifier name is a ``dotted name'' that may resolve either to343 # a module, a test case class, a TestSuite instance, a test method344 # within a test case class, or a callable object which returns a345 # TestCase or TestSuite instance."346 #347 # Does loadTestsFromName() raise the proper exception when trying to348 # resolve "a test method within a test case class" that doesn't exist349 # for the given name (relative to a provided module)?350 def test_loadTestsFromName__relative_invalid_testmethod(self):351 m = types.ModuleType('m')352 class MyTestCase(unittest2.TestCase):353 def test(self):354 pass355 m.testcase_1 = MyTestCase356 loader = unittest2.TestLoader()357 try:358 loader.loadTestsFromName('testcase_1.testfoo', m)359 except AttributeError, e:360 self.assertEqual(str(e), "type object 'MyTestCase' has no attribute 'testfoo'")361 else:362 self.fail("Failed to raise AttributeError")363 # "The specifier name is a ``dotted name'' that may resolve ... to364 # ... a callable object which returns a ... TestSuite instance"365 def test_loadTestsFromName__callable__TestSuite(self):366 m = types.ModuleType('m')367 testcase_1 = unittest2.FunctionTestCase(lambda: None)368 testcase_2 = unittest2.FunctionTestCase(lambda: None)369 def return_TestSuite():370 return unittest2.TestSuite([testcase_1, testcase_2])371 m.return_TestSuite = return_TestSuite372 loader = unittest2.TestLoader()373 suite = loader.loadTestsFromName('return_TestSuite', m)374 self.assertIsInstance(suite, loader.suiteClass)375 self.assertEqual(list(suite), [testcase_1, testcase_2])376 # "The specifier name is a ``dotted name'' that may resolve ... to377 # ... a callable object which returns a TestCase ... instance"378 def test_loadTestsFromName__callable__TestCase_instance(self):379 m = types.ModuleType('m')380 testcase_1 = unittest2.FunctionTestCase(lambda: None)381 def return_TestCase():382 return testcase_1383 m.return_TestCase = return_TestCase384 loader = unittest2.TestLoader()385 suite = loader.loadTestsFromName('return_TestCase', m)386 self.assertIsInstance(suite, loader.suiteClass)387 self.assertEqual(list(suite), [testcase_1])388 # "The specifier name is a ``dotted name'' that may resolve ... to389 # ... a callable object which returns a TestCase ... instance"390 #*****************************************************************391 #Override the suiteClass attribute to ensure that the suiteClass392 #attribute is used393 def test_loadTestsFromName__callable__TestCase_instance_ProperSuiteClass(self):394 class SubTestSuite(unittest2.TestSuite):395 pass396 m = types.ModuleType('m')397 testcase_1 = unittest2.FunctionTestCase(lambda: None)398 def return_TestCase():399 return testcase_1400 m.return_TestCase = return_TestCase401 loader = unittest2.TestLoader()402 loader.suiteClass = SubTestSuite403 suite = loader.loadTestsFromName('return_TestCase', m)404 self.assertIsInstance(suite, loader.suiteClass)405 self.assertEqual(list(suite), [testcase_1])406 # "The specifier name is a ``dotted name'' that may resolve ... to407 # ... a test method within a test case class"408 #*****************************************************************409 #Override the suiteClass attribute to ensure that the suiteClass410 #attribute is used411 def test_loadTestsFromName__relative_testmethod_ProperSuiteClass(self):412 class SubTestSuite(unittest2.TestSuite):413 pass414 m = types.ModuleType('m')415 class MyTestCase(unittest2.TestCase):416 def test(self):417 pass418 m.testcase_1 = MyTestCase419 loader = unittest2.TestLoader()420 loader.suiteClass=SubTestSuite421 suite = loader.loadTestsFromName('testcase_1.test', m)422 self.assertIsInstance(suite, loader.suiteClass)423 self.assertEqual(list(suite), [MyTestCase('test')])424 # "The specifier name is a ``dotted name'' that may resolve ... to425 # ... a callable object which returns a TestCase or TestSuite instance"426 #427 # What happens if the callable returns something else?428 def test_loadTestsFromName__callable__wrong_type(self):429 m = types.ModuleType('m')430 def return_wrong():431 return 6432 m.return_wrong = return_wrong433 loader = unittest2.TestLoader()434 try:435 loader.loadTestsFromName('return_wrong', m)436 except TypeError:437 pass438 else:439 self.fail("TestLoader.loadTestsFromName failed to raise TypeError")440 # "The specifier can refer to modules and packages which have not been441 # imported; they will be imported as a side-effect"442 def test_loadTestsFromName__module_not_loaded(self):443 # We're going to try to load this module as a side-effect, so it444 # better not be loaded before we try.445 #446 module_name = 'unittest2.test.dummy'447 sys.modules.pop(module_name, None)448 loader = unittest2.TestLoader()449 try:450 suite = loader.loadTestsFromName(module_name)451 self.assertIsInstance(suite, loader.suiteClass)452 self.assertEqual(list(suite), [])453 # module should now be loaded, thanks to loadTestsFromName()454 self.assertIn(module_name, sys.modules)455 finally:456 if module_name in sys.modules:457 del sys.modules[module_name]458 ################################################################459 ### Tests for TestLoader.loadTestsFromName()460 ### Tests for TestLoader.loadTestsFromNames()461 ################################################################462 # "Similar to loadTestsFromName(), but takes a sequence of names rather463 # than a single name."464 #465 # What happens if that sequence of names is empty?466 def test_loadTestsFromNames__empty_name_list(self):467 loader = unittest2.TestLoader()468 suite = loader.loadTestsFromNames([])469 self.assertIsInstance(suite, loader.suiteClass)470 self.assertEqual(list(suite), [])471 # "Similar to loadTestsFromName(), but takes a sequence of names rather472 # than a single name."473 # ...474 # "The method optionally resolves name relative to the given module"475 #476 # What happens if that sequence of names is empty?477 #478 # XXX Should this raise a ValueError or just return an empty TestSuite?479 def test_loadTestsFromNames__relative_empty_name_list(self):480 loader = unittest2.TestLoader()481 suite = loader.loadTestsFromNames([], unittest2)482 self.assertIsInstance(suite, loader.suiteClass)483 self.assertEqual(list(suite), [])484 # "The specifier name is a ``dotted name'' that may resolve either to485 # a module, a test case class, a TestSuite instance, a test method...
TestFem.py
Source:TestFem.py
...63Test.runTestsFromClass(femtest.testcommon.TestFemCommon)64# method65import unittest66thetest = "femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules"67alltest = unittest.TestLoader().loadTestsFromName(thetest)68unittest.TextTestRunner().run(alltest)69# examples from shell in build dir:70# all FreeCAD tests71./bin/FreeCAD --run-test 072./bin/FreeCADCmd --run-test 073# all FEM tests74./bin/FreeCAD --run-test "TestFem"75./bin/FreeCADCmd --run-test "TestFem"76# import Fem and FemGui77./bin/FreeCAD --run-test "femtest.testfemimport"78./bin/FreeCADCmd --run-test "femtest.testfemimport"79# other module80./bin/FreeCAD --run-test "femtest.app.test_femimport"81./bin/FreeCAD --run-test "femtest.app.test_ccxtools"82./bin/FreeCAD --run-test "femtest.app.test_common"83./bin/FreeCAD --run-test "femtest.app.test_material"84./bin/FreeCAD --run-test "femtest.app.test_mesh"85./bin/FreeCAD --run-test "femtest.app.test_object"86./bin/FreeCAD --run-test "femtest.app.test_result"87./bin/FreeCAD --run-test "femtest.app.test_solverframework"88./bin/FreeCADCmd --run-test "femtest.app.test_femimport"89./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools"90./bin/FreeCADCmd --run-test "femtest.app.test_common"91./bin/FreeCADCmd --run-test "femtest.app.test_material"92./bin/FreeCADCmd --run-test "femtest.app.test_mesh"93./bin/FreeCADCmd --run-test "femtest.app.test_object"94./bin/FreeCADCmd --run-test "femtest.app.test_result"95./bin/FreeCADCmd --run-test "femtest.app.test_solverframework"96# class97./bin/FreeCAD --run-test "femtest.testcommon.TestFemCommon"98# method99./bin/FreeCAD --run-test "femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules"100# unit test command to run a specific FEM unit test to copy for fast tests :-)101# to get all commands to start FreeCAD from build dir on Linux102# and run FEM unit test this could be used:103from femtest.utilstest import get_fem_test_defs as gf104gf()105./bin/FreeCADCmd --run-test "femtest.app.test_femimport.TestObjectExistance.test_objects_existance"106./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools.TestCcxTools.test_1_static_analysis"107./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools.TestCcxTools.test_2_static_multiple_material"108./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools.TestCcxTools.test_3_freq_analysis"109./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools.TestCcxTools.test_4_thermomech_analysis"110./bin/FreeCADCmd --run-test "femtest.app.test_ccxtools.TestCcxTools.test_5_Flow1D_thermomech_analysis"111./bin/FreeCADCmd --run-test "femtest.app.test_common.TestFemCommon.test_adding_refshaps"112./bin/FreeCADCmd --run-test "femtest.app.test_common.TestFemCommon.test_pyimport_all_FEM_modules"113./bin/FreeCADCmd --run-test "femtest.app.test_material.TestMaterialUnits.test_known_quantity_units"114./bin/FreeCADCmd --run-test "femtest.app.test_material.TestMaterialUnits.test_material_card_quantities"115./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshCommon.test_mesh_seg2_python"116./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshCommon.test_mesh_seg3_python"117./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshCommon.test_unv_save_load"118./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshCommon.test_writeAbaqus_precision"119./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_create"120./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_inp"121./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_unv"122./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_vkt"123./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_yml"124./bin/FreeCADCmd --run-test "femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_z88"125./bin/FreeCADCmd --run-test "femtest.app.test_object.TestObjectCreate.test_femobjects_make"126./bin/FreeCADCmd --run-test "femtest.app.test_object.TestObjectType.test_femobjects_type"127./bin/FreeCADCmd --run-test "femtest.app.test_object.TestObjectType.test_femobjects_isoftype"128./bin/FreeCADCmd --run-test "femtest.app.test_object.TestObjectType.test_femobjects_derivedfromfem"129./bin/FreeCADCmd --run-test "femtest.app.test_object.TestObjectType.test_femobjects_derivedfromstd"130./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_read_frd_massflow_networkpressure"131./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_stress_von_mises"132./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_stress_principal_std"133./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_stress_principal_reinforced"134./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_rho"135./bin/FreeCADCmd --run-test "femtest.app.test_result.TestResult.test_disp_abs"136./bin/FreeCADCmd --run-test "femtest.app.test_solverframework.TestSolverFrameWork.test_solver_calculix"137./bin/FreeCADCmd --run-test "femtest.app.test_solverframework.TestSolverFrameWork.test_solver_elmer"138# to get all command to start FreeCAD from build dir on Linux139# and run FEM unit test this could be used:140from femtest.utilstest import get_fem_test_defs as gf141gf("in")142import unittest143unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_ccxtools.TestCcxTools.test_1_static_analysis"))144import unittest145unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_ccxtools.TestCcxTools.test_2_static_multiple_material"))146import unittest147unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_ccxtools.TestCcxTools.test_3_freq_analysis"))148import unittest149unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_ccxtools.TestCcxTools.test_4_thermomech_analysis"))150import unittest151unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_ccxtools.TestCcxTools.test_5_Flow1D_thermomech_analysis"))152import unittest153unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_common.TestFemCommon.test_adding_refshaps"))154import unittest155unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_common.TestFemCommon.test_pyimport_all_FEM_modules"))156import unittest157unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_material.TestMaterialUnits.test_known_quantity_units"))158import unittest159unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_material.TestMaterialUnits.test_material_card_quantities"))160import unittest161unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshCommon.test_mesh_seg2_python"))162import unittest163unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshCommon.test_mesh_seg3_python"))164import unittest165unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshCommon.test_unv_save_load"))166import unittest167unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshCommon.test_writeAbaqus_precision"))168import unittest169unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_create"))170import unittest171unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_inp"))172import unittest173unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_unv"))174import unittest175unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_vkt"))176import unittest177unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_yml"))178import unittest179unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_mesh.TestMeshEleTetra10.test_tetra10_z88"))180import unittest181unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_object.TestObjectCreate.test_femobjects_make"))182import unittest183unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_object.TestObjectType.test_femobjects_type"))184import unittest185unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_object.TestObjectType.test_femobjects_isoftype"))186import unittest187unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_object.TestObjectType.test_femobjects_derivedfromfem"))188import unittest189unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_object.TestObjectType.test_femobjects_derivedfromstd"))190import unittest191unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_read_frd_massflow_networkpressure"))192import unittest193unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_stress_von_mises"))194import unittest195unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_stress_principal_std"))196import unittest197unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_stress_principal_reinforced"))198import unittest199unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_rho"))200import unittest201unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_result.TestResult.test_disp_abs"))202import unittest203unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_solverframework.TestSolverFrameWork.test_solver_calculix"))204import unittest205unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.app.test_solverframework.TestSolverFrameWork.test_solver_elmer"))206# open files from FEM test suite source code207# be careful on updating these files, they contain the original results!208# TODO update files, because some of them have non-existing FEM object classes209doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube.FCStd')210doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube_frequency.FCStd')211doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/cube_static.FCStd')212doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/Flow1D_thermomech.FCStd')213doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/multimat.FCStd')214doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/data/ccx/spine_thermomech.FCStd')215# open files generated from test suite216import femtest.utilstest as ut217ut.all_test_files()218doc = ut.cube_frequency()219doc = ut.cube_static()...
run_test.py
Source:run_test.py
...25 loader = unittest.TestLoader()26 suite = loader.discover(test_dir)27 runner.run(suite)28 suites = []29 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.test_base_augmenter'))30 # suites.append(unittest.TestLoader().loadTestsFromName('util.text.test_tokenizer'))31 # suites.append(unittest.TestLoader().loadTestsFromName('util.selection.test_filtering'))32 33 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.test_text_augmenter'))34 35 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.sentence.test_sentence'))36 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.sentence.test_context_word_embs_sentence'))37 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.sentence.test_abst_summ'))38 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.sentence.test_lambada'))39 40 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_word'))41 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_tfidf'))42 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_spelling'))43 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_antonym'))44 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_synonym'))45 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_context_word_embs'))46 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_back_translation'))47 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_word_embs'))48 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_random_word'))49 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.word.test_reserved'))50 # suites.append(unittest.TestLoader().loadTestsFromName('model.word.test_word_embs_model'))51 52 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.char.test_char'))53 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.char.test_keyboard'))54 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.char.test_ocr'))55 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.char.test_random_char'))56 57 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.test_audio_augmenter'))58 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_audio'))59 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_crop'))60 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_loudness'))61 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_mask'))62 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_noise'))63 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_pitch'))64 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_shift'))65 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_speed'))66 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_vtlp'))67 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_normalization'))68 # suites.append(unittest.TestLoader().loadTestsFromName('augmenter.audio.test_inversion'))69 # suites.append(unittest.TestLoader().loadTestsFromName('flow.test_flow'))70 # suites.append(unittest.TestLoader().loadTestsFromName('flow.test_sequential'))71 # suites.append(unittest.TestLoader().loadTestsFromName('flow.test_sometimes'))72 for suite in suites:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!