當前位置: 首頁>>代碼示例>>Python>>正文


Python TestCase.TestCase類代碼示例

本文整理匯總了Python中TestCase.TestCase的典型用法代碼示例。如果您正苦於以下問題:Python TestCase類的具體用法?Python TestCase怎麽用?Python TestCase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TestCase類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: runBenchmark

    def runBenchmark(self,benchmark,stdout):
        config = self.getConfiguration()
        testCase = TestCase(config,stdout)
        testCase.prepare(benchmark)

        self.scanFedSizes(benchmark,testCase)
        testCase.destroy()
開發者ID:mommsen,項目名稱:evb,代碼行數:7,代碼來源:runBenchmarks.py

示例2: run

    def run(self, stdout):

        logging.info("RestartableRunner.run() called")

        self.testRunner.startLaunchers()

        # TODO: check if all launchers are responding (with timeout)
        # instead of waiting for a fixed amount of time
        time.sleep(5)

        configData = self.testRunner.getAllConfigurations()[0]
        config = configData['config']
        testName = configData['name']

        try:
            while not self.stopFlag:
                try:
                    self.testCase = TestCase(config, stdout, afterStartupCallback=self.afterStartupCallback)
                    self.testCase.prepare(testName)

                    fragSize = self.testRunner.getFedSizes()
                    assert len(fragSize) == 1

                    fragSize = fragSize[0]
                    fragSizeRMS = int(fragSize * self.testRunner.args['rms'])

                    # this should only terminate when the user terminates the optimization
                    self.testCase.runScan(fragSize, fragSizeRMS, self.testRunner.args)

                    # evb was stopped
                    self.evbStarted.clear()
                    self.evbStopped.set()

                    self.testCase.destroy()
                    self.testCase = None

                except BadConfig:
                    self.stopFlag = True
                    sys.exit(1)
        finally:
            self.testRunner.stopLaunchers()
開發者ID:andreh12,項目名稱:evb,代碼行數:41,代碼來源:RestartableRunner.py

示例3: TestCaseTest

class TestCaseTest(TestCase):
    def setUp(self):
        self.result = TestResult()

    def testTemplateMethod(self):
        test = WasRun("testMethod")
        test.run(self.result)
        assert "setUp testMethod tearDown" == test.log

    def testResult(self):
        test = WasRun("testMethod")
        test.run(self.result)
        assert "1 run, 0 failed" == self.result.summary()

    def testFailedResultFormatting(self):
        self.result.testStarted()
        self.result.testFailed()
        assert "1 run, 1 failed" == self.result.summary()

    def testFailedResult(self):
        self.test = WasRun("testBrokenMethod")
        self.test.run(self.result)
        assert "1 run, 1 failed" == self.result.summary()

    def checkForLog(self):
        self.test = WasRun("testMethod")
        self.test.run(self.result)
        assert path.isfile("C:/Nathans Python Folder/log.txt")

    def testSetUpException(self):
        self.test = TestCase("setUp")
        self.test.run(self.result)
        assert "1 run, 1 failed" == self.result.summary()

    def testSuite(self):
        suite = TestSuite()
        suite.add(TestCaseTest("testFailedResultFormatting"))
        suite.add(TestCaseTest("setUp"))
        suite.add(TestCaseTest("testTemplateMethod"))
        suite.add(WasRun("testMethod"))
        suite.add(TestCaseTest("testResult"))
        suite.add(WasRun("testBrokenMethod"))
        suite.add(TestCaseTest("testSetUpException"))
        suite.run(self.result)
        assert "6 run, 2 failed" == self.result.summary()
開發者ID:nathanh89,項目名稱:TDDPythonExample,代碼行數:45,代碼來源:TestCaseTest.py

示例4: testThatEvenMoreFilesAreExcluded

	def testThatEvenMoreFilesAreExcluded(self):
		expectedOutput = \
self.getBaseDir() + """CgrepTest/a.html:1:needle
"""
		self._CfgrepTest1("needle", "needle", expectedOutput)

	def _CfgrepTest1(self, actualNeedle, searchNeedle, expectedOutput, extraParameters=""):
		os.system("rm -rf CgrepTest")
		os.mkdir("CgrepTest")
		os.system("echo %s > CgrepTest/a.html"% actualNeedle)			# Will list this file
		os.mkdir("CgrepTest/vehicles")
		os.system("echo %s > CgrepTest/vehicles/a"% actualNeedle)
		os.mkdir("CgrepTest/states")
		os.system("echo %s > CgrepTest/states/a"% actualNeedle)
		os.mkdir("CgrepTest/states2")
		os.system("echo %s > CgrepTest/states2/a"% actualNeedle)
		command = "~/svn/devscripts/bin/%s %s %s %s"% (self.getCommand(), searchNeedle, self.myTestDir, extraParameters)
		procHandle = os.popen(command)
		output = procHandle.read()
		os.system("rm -rf CgrepTest")

		self.myAssertEqual(expectedOutput, output)
		
	def getCommand(self):
		return "cfgrep"
	

if __name__ == "__main__":
	TestCase.main()
開發者ID:TylerRick,項目名稱:command-line,代碼行數:29,代碼來源:CfgrepTest.py

示例5: main

def main():
    """This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. """

    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel = TestCase("channel")
    channel.cfg_dir = "euler/channel"
    channel.cfg_file = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-3.071007, 2.301191, 0.008562, 0.028922]  # last 4 columns
    channel.su2_exec = "parallel_computation.py -f"
    channel.timeout = 1600
    channel.tol = 0.00001
    test_list.append(channel)

    # NACA0012
    naca0012 = TestCase("naca0012")
    naca0012.cfg_dir = "euler/naca0012"
    naca0012.cfg_file = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-6.237188, -5.641250, 0.334843, 0.022206]  # last 4 columns
    naca0012.su2_exec = "parallel_computation.py -f"
    naca0012.timeout = 1600
    naca0012.tol = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge
    wedge = TestCase("wedge")
    wedge.cfg_dir = "euler/wedge"
    wedge.cfg_file = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-1.690232, 3.924432, -0.252221, 0.044419]  # last 4 columns
    wedge.su2_exec = "parallel_computation.py -f"
    wedge.timeout = 1600
    wedge.tol = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6 = TestCase("oneram6")
    oneram6.cfg_dir = "euler/oneram6"
    oneram6.cfg_file = "inv_ONERAM6.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-13.400678, -12.932056, 0.282557, 0.012706]  # last 4 columns
    oneram6.su2_exec = "parallel_computation.py -f"
    oneram6.timeout = 3200
    oneram6.tol = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate = TestCase("flatplate")
    flatplate.cfg_dir = "navierstokes/flatplate"
    flatplate.cfg_file = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.231727, 0.261637, -0.166869, 0.012707]  # last 4 columns
    flatplate.su2_exec = "parallel_computation.py -f"
    flatplate.timeout = 1600
    flatplate.tol = 0.00001
    test_list.append(flatplate)

    # Laminar cylinder (steady)
    cylinder = TestCase("cylinder")
    cylinder.cfg_dir = "navierstokes/cylinder"
    cylinder.cfg_file = "lam_cylinder.cfg"
    cylinder.test_iter = 25
    cylinder.test_vals = [-6.757291, -1.289309, -0.125948, 0.625438]  # last 4 columns
    cylinder.su2_exec = "parallel_computation.py -f"
    cylinder.timeout = 1600
    cylinder.tol = 0.00001
    test_list.append(cylinder)

    # Laminar cylinder (low Mach correction)
    cylinder_lowmach = TestCase("cylinder_lowmach")
    cylinder_lowmach.cfg_dir = "navierstokes/cylinder"
    cylinder_lowmach.cfg_file = "cylinder_lowmach.cfg"
    cylinder_lowmach.test_iter = 25
    cylinder_lowmach.test_vals = [-6.861860, -1.399846, -1.557250, 110.230719]  # last 4 columns
    cylinder_lowmach.su2_exec = "parallel_computation.py -f"
    cylinder_lowmach.timeout = 1600
    cylinder_lowmach.tol = 0.00001
    test_list.append(cylinder_lowmach)

    ##########################
    ### Compressible RANS  ###
    ##########################

    # RAE2822 SA
    rae2822_sa = TestCase("rae2822_sa")
    rae2822_sa.cfg_dir = "rans/rae2822"
    rae2822_sa.cfg_file = "turb_SA_RAE2822.cfg"
#.........這裏部分代碼省略.........
開發者ID:youmengtian,項目名稱:SU2,代碼行數:101,代碼來源:parallel_regression.py

示例6: main

def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. '''

    test_list = []

    #####################################
    ### Disc. adj. compressible Euler ###
    #####################################

    # Inviscid NACA0012
    discadj_naca0012           = TestCase('discadj_naca0012')
    discadj_naca0012.cfg_dir   = "cont_adj_euler/naca0012"
    discadj_naca0012.cfg_file  = "inv_NACA0012_discadj.cfg"
    discadj_naca0012.test_iter = 100
    discadj_naca0012.test_vals = [-3.606841, -9.035214, -0.000000, 0.005688] #last 4 columns
    discadj_naca0012.su2_exec  = "parallel_computation.py -f"
    discadj_naca0012.timeout   = 1600
    discadj_naca0012.tol       = 0.00001
    test_list.append(discadj_naca0012)
   
    # Inviscid Cylinder 3D (multiple markers)
    discadj_cylinder3D           = TestCase('discadj_cylinder3D')
    discadj_cylinder3D.cfg_dir   = "disc_adj_euler/cylinder3D"
    discadj_cylinder3D.cfg_file  = "inv_cylinder3D.cfg"
    discadj_cylinder3D.test_iter = 5
    discadj_cylinder3D.test_vals = [-3.720476, -4.039256, 0.000000, 0.000000] #last 4 columns
    discadj_cylinder3D.su2_exec  = "parallel_computation.py -f"
    discadj_cylinder3D.timeout   = 1600
    discadj_cylinder3D.tol       = 0.00001
    test_list.append(discadj_cylinder3D)

    ####################################
    ### Disc. adj. compressible RANS ###
    ####################################

    # Adjoint turbulent NACA0012 SA
    discadj_rans_naca0012_sa           = TestCase('discadj_rans_naca0012_sa')
    discadj_rans_naca0012_sa.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sa.cfg_file  = "turb_NACA0012_sa.cfg"
    discadj_rans_naca0012_sa.test_iter = 10
    discadj_rans_naca0012_sa.test_vals = [-1.751965, 0.485796, 0.182895, -0.000018] #last 4 columns
    discadj_rans_naca0012_sa.su2_exec  = "parallel_computation.py -f"
    discadj_rans_naca0012_sa.timeout   = 1600
    discadj_rans_naca0012_sa.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sa)

    # Adjoint turbulent NACA0012 SST
    discadj_rans_naca0012_sst           = TestCase('discadj_rans_naca0012_sst')
    discadj_rans_naca0012_sst.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sst.cfg_file  = "turb_NACA0012_sst.cfg"
    discadj_rans_naca0012_sst.test_iter = 10
    discadj_rans_naca0012_sst.test_vals = [-1.654193, -0.499281, 0.145545, -0.000018] #last 4 columns
    discadj_rans_naca0012_sst.su2_exec  = "parallel_computation.py -f"
    discadj_rans_naca0012_sst.timeout   = 1600
    discadj_rans_naca0012_sst.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sst)

    #######################################
    ### Disc. adj. incompressible Euler ###
    #######################################

    # Adjoint Incompressible Inviscid NACA0012
    discadj_incomp_NACA0012           = TestCase('discadj_incomp_NACA0012')
    discadj_incomp_NACA0012.cfg_dir   = "cont_adj_incomp_euler/naca0012"
    discadj_incomp_NACA0012.cfg_file  = "incomp_NACA0012_disc.cfg"
    discadj_incomp_NACA0012.test_iter = 20
    discadj_incomp_NACA0012.test_vals = [-2.917789, -2.714752, 0.000000, 0.000000] #last 4 columns
    discadj_incomp_NACA0012.su2_exec  = "parallel_computation.py -f"
    discadj_incomp_NACA0012.timeout   = 1600
    discadj_incomp_NACA0012.tol       = 0.00001
    test_list.append(discadj_incomp_NACA0012)

    #####################################
    ### Disc. adj. incompressible N-S ###
    #####################################

    # Adjoint Incompressible Viscous Cylinder
    discadj_incomp_cylinder           = TestCase('discadj_incomp_cylinder')
    discadj_incomp_cylinder.cfg_dir   = "cont_adj_incomp_navierstokes/cylinder"
    discadj_incomp_cylinder.cfg_file  = "lam_incomp_cylinder_disc.cfg"
    discadj_incomp_cylinder.test_iter = 20
    discadj_incomp_cylinder.test_vals = [-2.727423, -2.272530, 0.000000, 0.000000] #last 4 columns
    discadj_incomp_cylinder.su2_exec  = "parallel_computation.py -f"
    discadj_incomp_cylinder.timeout   = 1600
    discadj_incomp_cylinder.tol       = 0.00001
    test_list.append(discadj_incomp_cylinder)

    ######################################
    ### Disc. adj. incompressible RANS ###
    ######################################

    # Adjoint Incompressible Turbulent NACA 0012
    discadj_incomp_turb_NACA0012           = TestCase('discadj_incomp_turb_NACA0012')
    discadj_incomp_turb_NACA0012.cfg_dir   = "incomp_rans/naca0012"
    discadj_incomp_turb_NACA0012.cfg_file  = "naca0012_disc.cfg"
    discadj_incomp_turb_NACA0012.test_iter = 100
    discadj_incomp_turb_NACA0012.test_vals = [-3.645810, -1.625922, 0.000000, 0.000000] #last 4 columns
    discadj_incomp_turb_NACA0012.su2_exec  = "parallel_computation.py -f"
#.........這裏部分代碼省略.........
開發者ID:youmengtian,項目名稱:SU2,代碼行數:101,代碼來源:parallel_regression_AD.py

示例7: __init__

 def __init__(self, name):
     TestCase.__init__(self, name)
開發者ID:tomek199,項目名稱:xUnit,代碼行數:2,代碼來源:WasRun.py

示例8: main

def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do nightly checks to make sure nothing is broken. '''

    workdir = os.getcwd()

    # environment variables for SU2
    os.environ['TEST_HOME'] = '/home/ale11/.cruise/projects/parallel_regression/work'
    os.environ['SU2_HOME'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2'
    os.environ['SU2_RUN'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2/bin'
    os.environ['PATH'] = os.environ['PATH'] + ':' + os.environ['SU2_RUN']

    # sync Test Cases repo
    os.chdir( os.environ['TEST_HOME'] )
    os.system('git fetch')
    os.system('git checkout develop')
    os.system('git pull origin develop')

    # sync SU2 repo
    os.chdir( os.environ['SU2_HOME'] )
    os.system('git fetch')
    os.system('git checkout develop')
    os.system('git pull origin develop')

    # Build SU2_CFD in parallel using autoconf
    os.system('./configure --prefix=$SU2_HOME --enable-mpi --with-cc=`which mpicc` --with-cxx=`which mpicxx` CXXFLAGS="-O3"')
    os.system('make clean')
    os.system('make install')

    os.chdir(os.environ['SU2_RUN'])
    if not os.path.exists("./SU2_CFD"):
        print 'Could not build SU2_CFD'
        sys.exit(1)

    if not os.path.exists("./SU2_PRT"):
        print 'Could not build SU2_PRT'
        sys.exit(1)

    os.chdir(workdir)  
    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel           = TestCase('channel')
    channel.cfg_dir   = "euler/channel"
    channel.cfg_file  = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-2.984481, 2.389875, 0.008865, 0.027854] #last 4 columns
    channel.su2_exec  = "parallel_computation.py -f"
    channel.timeout   = 1600
    channel.tol       = 0.00001
    test_list.append(channel)

    # NACA0012 
    naca0012           = TestCase('naca0012')
    naca0012.cfg_dir   = "euler/naca0012"
    naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-6.237188, -5.641250, 0.334843, 0.022206] #last 4 columns
    naca0012.su2_exec  = "parallel_computation.py -f"
    naca0012.timeout   = 1600
    naca0012.tol       = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge 
    wedge           = TestCase('wedge')
    wedge.cfg_dir   = "euler/wedge"
    wedge.cfg_file  = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-1.702502, 3.923373, -0.252116, 0.044396] #last 4 columns
    wedge.su2_exec  = "parallel_computation.py -f"
    wedge.timeout   = 1600
    wedge.tol       = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6           = TestCase('oneram6')
    oneram6.cfg_dir   = "euler/oneram6"
    oneram6.cfg_file  = "inv_ONERAM6_JST.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-4.701280, -4.154921, 0.270257, 0.019095] #last 4 columns
    oneram6.su2_exec  = "parallel_computation.py -f"
    oneram6.timeout   = 3200
    oneram6.tol       = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate           = TestCase('flatplate')
    flatplate.cfg_dir   = "navierstokes/flatplate"
    flatplate.cfg_file  = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.233923, 0.259801, -0.166790, 0.012722] #last 4 columns
    flatplate.su2_exec  = "parallel_computation.py -f"
#.........這裏部分代碼省略.........
開發者ID:FReisITA,項目名稱:TestCases,代碼行數:101,代碼來源:parallel_regression.py

示例9: main

def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. '''

    test_list = []

    #####################################
    ### Disc. adj. compressible Euler ###
    #####################################

    # Inviscid NACA0012
    discadj_naca0012           = TestCase('discadj_naca0012')
    discadj_naca0012.cfg_dir   = "cont_adj_euler/naca0012"
    discadj_naca0012.cfg_file  = "inv_NACA0012_discadj.cfg"
    discadj_naca0012.test_iter = 100
    discadj_naca0012.test_vals = [-3.606839,-9.035212,-3.3386e-07,1.8777e-01] #last 4 columns
    discadj_naca0012.su2_exec  = "SU2_CFD_AD"
    discadj_naca0012.timeout   = 1600
    discadj_naca0012.tol       = 0.00001
    test_list.append(discadj_naca0012)

    #######################################################
    ### Disc. adj. compressible RANS                    ###
    #######################################################
    
    # Adjoint turbulent NACA0012 SA
    discadj_rans_naca0012_sa           = TestCase('discadj_rans_naca0012_sa')
    discadj_rans_naca0012_sa.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sa.cfg_file  = "turb_NACA0012_sa.cfg"
    discadj_rans_naca0012_sa.test_iter = 10
    discadj_rans_naca0012_sa.test_vals = [-1.751947, 0.485758, 0.181440, -0.385110] #last 4 columns
    discadj_rans_naca0012_sa.su2_exec  = "SU2_CFD_AD"
    discadj_rans_naca0012_sa.timeout   = 1600
    discadj_rans_naca0012_sa.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sa)

    # Adjoint turbulent NACA0012 SST
    discadj_rans_naca0012_sst           = TestCase('discadj_rans_naca0012_sst')
    discadj_rans_naca0012_sst.cfg_dir   = "disc_adj_rans/naca0012"
    discadj_rans_naca0012_sst.cfg_file  = "turb_NACA0012_sst.cfg"
    discadj_rans_naca0012_sst.test_iter = 10
    discadj_rans_naca0012_sst.test_vals = [-1.658566, -0.487694, 0.087556, -0.537010] #last 4 columns
    discadj_rans_naca0012_sst.su2_exec  = "SU2_CFD_AD"
    discadj_rans_naca0012_sst.timeout   = 1600
    discadj_rans_naca0012_sst.tol       = 0.00001
    test_list.append(discadj_rans_naca0012_sst)

    #######################################################
    ### Unsteady Disc. adj. compressible RANS           ###
    #######################################################
   
    # Turbulent Cylinder
    discadj_cylinder           = TestCase('unsteady_cylinder')
    discadj_cylinder.cfg_dir   = "disc_adj_rans/cylinder"
    discadj_cylinder.cfg_file  = "cylinder.cfg" 
    discadj_cylinder.test_iter = 10
    discadj_cylinder.test_vals = [3.522068,-1.787841,-1.2030e-02,1.1156e-03] #last 4 columns
    discadj_cylinder.su2_exec  = "SU2_CFD_AD"
    discadj_cylinder.timeout   = 1600
    discadj_cylinder.tol       = 0.00001
    discadj_cylinder.unsteady  = True
    test_list.append(discadj_cylinder)

    ######################################
    ### RUN TESTS                      ###
    ######################################  

    pass_list = [ test.run_test() for test in test_list ]
    
    ######################################
    ### RUN PYTHON TESTS               ###
    ######################################
    
    # test discrete_adjoint.py
    discadj_euler_py = TestCase('discadj_euler_py')
    discadj_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    discadj_euler_py.cfg_file  = "inv_NACA0012.cfg"
    discadj_euler_py.test_iter = 10
    discadj_euler_py.su2_exec  = "discrete_adjoint.py"
    discadj_euler_py.timeout   = 1600
    discadj_euler_py.reference_file = "of_grad_cd_disc.dat.ref"
    discadj_euler_py.test_file = "of_grad_cd.dat"
    pass_list.append(discadj_euler_py.run_filediff())
    test_list.append(discadj_euler_py)
    
    # test direct_differentiation.py
    directdiff_euler_py = TestCase('directdiff_euler_py')
    directdiff_euler_py.cfg_dir = "cont_adj_euler/naca0012"
    directdiff_euler_py.cfg_file  = "inv_NACA0012_FD.cfg"
    directdiff_euler_py.test_iter = 10
    directdiff_euler_py.su2_exec  = "direct_differentiation.py"
    directdiff_euler_py.timeout   = 1600
    directdiff_euler_py.reference_file = "of_grad_directdiff.dat.ref"
    directdiff_euler_py.test_file = "DIRECTDIFF/of_grad_directdiff.dat"
    pass_list.append(directdiff_euler_py.run_filediff())
    test_list.append(directdiff_euler_py)

    # Tests summary
    print '=================================================================='
#.........這裏部分代碼省略.........
開發者ID:HolyGeneralK,項目名稱:SU2,代碼行數:101,代碼來源:serial_regression_AD.py

示例10: main

def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. '''

    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel           = TestCase('channel')
    channel.cfg_dir   = "euler/channel"
    channel.cfg_file  = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-3.110240, 2.263506, 0.008686, 0.029098] #last 4 columns
    channel.su2_exec  = "SU2_CFD"
    channel.timeout   = 1600
    channel.tol       = 0.00001
    test_list.append(channel)

    # NACA0012 
    naca0012           = TestCase('naca0012')
    naca0012.cfg_dir   = "euler/naca0012"
    naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-6.191618, -5.592802, 0.334809, 0.022197] #last 4 columns
    naca0012.su2_exec  = "SU2_CFD"
    naca0012.timeout   = 1600
    naca0012.tol       = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge 
    wedge           = TestCase('wedge')
    wedge.cfg_dir   = "euler/wedge"
    wedge.cfg_file  = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-1.711318, 3.913749, -0.252131, 0.044402] #last 4 columns
    wedge.su2_exec  = "SU2_CFD"
    wedge.timeout   = 1600
    wedge.tol       = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6           = TestCase('oneram6')
    oneram6.cfg_dir   = "euler/oneram6"
    oneram6.cfg_file  = "inv_ONERAM6.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-13.393130, -12.928941, 0.282557, 0.012706] #last 4 columns
    oneram6.su2_exec  = "SU2_CFD"
    oneram6.timeout   = 9600
    oneram6.tol       = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate           = TestCase('flatplate')
    flatplate.cfg_dir   = "navierstokes/flatplate"
    flatplate.cfg_file  = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.231916, 0.261866, -0.166832, 0.012717] #last 4 columns
    flatplate.su2_exec  = "SU2_CFD"
    flatplate.timeout   = 1600
    flatplate.tol       = 0.00001
    test_list.append(flatplate)

    # Laminar cylinder (steady)
    cylinder           = TestCase('cylinder')
    cylinder.cfg_dir   = "navierstokes/cylinder"
    cylinder.cfg_file  = "lam_cylinder.cfg"
    cylinder.test_iter = 25
    cylinder.test_vals = [-6.765426, -1.297422, 0.019496, 0.310082] #last 4 columns
    cylinder.su2_exec  = "SU2_CFD"
    cylinder.timeout   = 1600
    cylinder.tol       = 0.00001
    test_list.append(cylinder)

    ##########################
    ### Compressible RANS  ###
    ##########################

    # RAE2822 SA
    rae2822_sa           = TestCase('rae2822_sa')
    rae2822_sa.cfg_dir   = "rans/rae2822"
    rae2822_sa.cfg_file  = "turb_SA_RAE2822.cfg"
    rae2822_sa.test_iter = 100
    rae2822_sa.test_vals = [-3.442524, -5.441383, 0.884279, 0.024730] #last 4 columns
    rae2822_sa.su2_exec  = "SU2_CFD"
    rae2822_sa.timeout   = 1600
    rae2822_sa.tol       = 0.00001
    test_list.append(rae2822_sa)
    
    # RAE2822 SST
    rae2822_sst           = TestCase('rae2822_sst')
    rae2822_sst.cfg_dir   = "rans/rae2822"
    rae2822_sst.cfg_file  = "turb_SST_RAE2822.cfg"
#.........這裏部分代碼省略.........
開發者ID:jlabroquere,項目名稱:SU2,代碼行數:101,代碼來源:serial_regression.py

示例11: main

def main():
    '''This program runs SU^2 and ensures that the output matches specified values. 
       This will be used to do nightly checks to make sure nothing is broken. '''

    workdir = os.getcwd()

    # environment variables for SU2
    os.environ['SU2_HOME'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2'
    os.environ['SU2_RUN'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2/bin'
    os.environ['PATH'] = os.environ['PATH'] + ':' + os.environ['SU2_RUN']

    # sync SU2 repo
    os.chdir( os.environ['SU2_HOME'] )
    os.system('git fetch')
    os.system('git checkout develop')
    os.system('git pull origin develop')

    # Build SU2_CFD in parallel using autoconf
    os.system('./configure --prefix=$SU2_HOME --with-MPI=mpicxx CXXFLAGS="-O3"')
    os.system('make clean')
    os.system('make install')

    os.chdir(os.environ['SU2_RUN'])
    if not os.path.exists("./SU2_CFD"):
        print 'Could not build SU2_CFD'
        sys.exit(1)

    if not os.path.exists("./SU2_PRT"):
        print 'Could not build SU2_PRT'
        sys.exit(1)

    os.chdir(workdir)  
    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel           = TestCase('channel')
    channel.cfg_dir   = "euler/channel"
    channel.cfg_file  = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-3.007706, 2.358555, 0.008379, 0.028547]
    channel.su2_exec  = "parallel_computation.py -f"
    channel.timeout   = 1600
    channel.tol       = 0.00001
    test_list.append(channel)

    # NACA0012 
    naca0012           = TestCase('naca0012')
    naca0012.cfg_dir   = "euler/naca0012"
    naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-6.157022, -5.537399, 0.334831, 0.022209]
    naca0012.su2_exec  = "parallel_computation.py -f"
    naca0012.timeout   = 1600
    naca0012.tol       = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge 
    wedge           = TestCase('wedge')
    wedge.cfg_dir   = "euler/wedge"
    wedge.cfg_file  = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-1.647184, 3.989725, -0.251604, 0.044317]
    wedge.su2_exec  = "parallel_computation.py -f"
    wedge.timeout   = 1600
    wedge.tol       = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6           = TestCase('oneram6')
    oneram6.cfg_dir   = "euler/oneram6"
    oneram6.cfg_file  = "inv_ONERAM6_JST.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-4.707461, -4.138449, 0.269324, 0.018891]
    oneram6.su2_exec  = "parallel_computation.py -f"
    oneram6.timeout   = 3200
    oneram6.tol       = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate           = TestCase('flatplate')
    flatplate.cfg_dir   = "navierstokes/flatplate"
    flatplate.cfg_file  = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.232930, 0.260877, -0.166066, 0.013093]
    flatplate.su2_exec  = "parallel_computation.py -f"
    flatplate.timeout   = 1600
    flatplate.tol       = 0.00001
    test_list.append(flatplate)


    # Laminar cylinder (steady)
    cylinder           = TestCase('cylinder')
#.........這裏部分代碼省略.........
開發者ID:maliak,項目名稱:TestCases,代碼行數:101,代碼來源:parallel_regression.py

示例12: main

def main():
    '''This program runs SU^2 and ensures that the output matches specified values. 
       This will be used to do nightly checks to make sure nothing is broken. '''

    workdir = os.getcwd()

    # environment variables for SU2
    os.environ['SU2_HOME'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2'
    os.environ['SU2_RUN'] = '/home/ale11/.cruise/projects/parallel_regression/work/SU2/bin'
    os.environ['PATH'] = os.environ['PATH'] + ':' + os.environ['SU2_RUN']

    # sync SU2 repo
    os.chdir( os.environ['SU2_HOME'] )
    os.system('git pull')  

    # Build SU2_CFD in parallel using autoconf
    os.system('./configure --prefix=$SU2_HOME --with-MPI=mpicxx CXXFLAGS="-O3"')
    os.system('make clean')
    os.system('make install')

    os.chdir(os.environ['SU2_RUN'])
    if not os.path.exists("./SU2_CFD"):
        print 'Could not build SU2_CFD'
        sys.exit(1)

    if not os.path.exists("./SU2_PRT"):
        print 'Could not build SU2_PRT'
        sys.exit(1)

    os.chdir(workdir)  
    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel           = TestCase('channel')
    channel.cfg_dir   = "euler/channel"
    channel.cfg_file  = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-2.413846,2.965840,0.007590,0.051651]
    channel.su2_exec  = "parallel_computation.py -f"
    channel.timeout   = 1600
    channel.tol       = 0.00001
    test_list.append(channel)

    # NACA0012 
    naca0012           = TestCase('naca0012')
    naca0012.cfg_dir   = "euler/naca0012"
    naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-3.751809,-3.271265,0.136604,0.066791]
    naca0012.su2_exec  = "parallel_computation.py -f"
    naca0012.timeout   = 1600
    naca0012.tol       = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge 
    wedge           = TestCase('wedge')
    wedge.cfg_dir   = "euler/wedge"
    wedge.cfg_file  = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-2.694577,3.148295,-0.252137,0.044398]
    wedge.su2_exec  = "parallel_computation.py -f"
    wedge.timeout   = 1600
    wedge.tol       = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6           = TestCase('oneram6')
    oneram6.cfg_dir   = "euler/oneram6"
    oneram6.cfg_file  = "inv_ONERAM6_JST.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-4.819412,-4.286432,0.288842,0.016334]
    oneram6.su2_exec  = "parallel_computation.py -f"
    oneram6.timeout   = 3200
    oneram6.tol       = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate           = TestCase('flatplate')
    flatplate.cfg_dir   = "navierstokes/flatplate"
    flatplate.cfg_file  = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.142353,0.347570,0.029870,0.015971]
    flatplate.su2_exec  = "parallel_computation.py -f"
    flatplate.timeout   = 1600
    flatplate.tol       = 0.00001
    test_list.append(flatplate)


    # Laminar cylinder (steady)
    cylinder           = TestCase('cylinder')
    cylinder.cfg_dir   = "navierstokes/cylinder"
    cylinder.cfg_file  = "lam_cylinder.cfg"
#.........這裏部分代碼省略.........
開發者ID:AlexMalo,項目名稱:TestCases,代碼行數:101,代碼來源:parallel_regression.py

示例13: main

def main():
    '''This program runs SU2 and ensures that the output matches specified values. 
       This will be used to do checks when code is pushed to github 
       to make sure nothing is broken. '''

    test_list = []

    ##########################
    ### Compressible Euler ###
    ##########################

    # Channel
    channel           = TestCase('channel')
    channel.cfg_dir   = "euler/channel"
    channel.cfg_file  = "inv_channel_RK.cfg"
    channel.test_iter = 100
    channel.test_vals = [-3.071007, 2.301191, 0.008562, 0.028922] #last 4 columns
    channel.su2_exec  = "parallel_computation.py -f"
    channel.timeout   = 1600
    channel.tol       = 0.00001
    test_list.append(channel)

    # NACA0012 
    naca0012           = TestCase('naca0012')
    naca0012.cfg_dir   = "euler/naca0012"
    naca0012.cfg_file  = "inv_NACA0012_Roe.cfg"
    naca0012.test_iter = 100
    naca0012.test_vals = [-6.237188, -5.641250, 0.334843, 0.022206] #last 4 columns
    naca0012.su2_exec  = "parallel_computation.py -f"
    naca0012.timeout   = 1600
    naca0012.tol       = 0.00001
    test_list.append(naca0012)

    # Supersonic wedge 
    wedge           = TestCase('wedge')
    wedge.cfg_dir   = "euler/wedge"
    wedge.cfg_file  = "inv_wedge_HLLC.cfg"
    wedge.test_iter = 100
    wedge.test_vals = [-1.690232, 3.924432, -0.252221, 0.044419] #last 4 columns
    wedge.su2_exec  = "parallel_computation.py -f"
    wedge.timeout   = 1600
    wedge.tol       = 0.00001
    test_list.append(wedge)

    # ONERA M6 Wing
    oneram6           = TestCase('oneram6')
    oneram6.cfg_dir   = "euler/oneram6"
    oneram6.cfg_file  = "inv_ONERAM6.cfg"
    oneram6.test_iter = 10
    oneram6.test_vals = [-13.400678, -12.932056, 0.282557, 0.012706] #last 4 columns
    oneram6.su2_exec  = "parallel_computation.py -f"
    oneram6.timeout   = 3200
    oneram6.tol       = 0.00001
    test_list.append(oneram6)

    ##########################
    ###  Compressible N-S  ###
    ##########################

    # Laminar flat plate
    flatplate           = TestCase('flatplate')
    flatplate.cfg_dir   = "navierstokes/flatplate"
    flatplate.cfg_file  = "lam_flatplate.cfg"
    flatplate.test_iter = 100
    flatplate.test_vals = [-5.231743, 0.261628, -0.166871, 0.012706] #last 4 columns
    flatplate.su2_exec  = "parallel_computation.py -f"
    flatplate.timeout   = 1600
    flatplate.tol       = 0.00001
    test_list.append(flatplate)


    # Laminar cylinder (steady)
    cylinder           = TestCase('cylinder')
    cylinder.cfg_dir   = "navierstokes/cylinder"
    cylinder.cfg_file  = "lam_cylinder.cfg"
    cylinder.test_iter = 25
    cylinder.test_vals = [-6.757291, -1.289309, -0.125948, 0.625438] #last 4 columns
    cylinder.su2_exec  = "parallel_computation.py -f"
    cylinder.timeout   = 1600
    cylinder.tol       = 0.00001
    test_list.append(cylinder)

    # Laminar cylinder (low Mach correction)
    cylinder_lowmach           = TestCase('cylinder_lowmach')
    cylinder_lowmach.cfg_dir   = "navierstokes/cylinder"
    cylinder_lowmach.cfg_file  = "cylinder_lowmach.cfg"
    cylinder_lowmach.test_iter = 25
    cylinder_lowmach.test_vals = [-6.861860, -1.399846, -1.557250, 110.230719] #last 4 columns
    cylinder_lowmach.su2_exec  = "parallel_computation.py -f"
    cylinder_lowmach.timeout   = 1600
    cylinder_lowmach.tol       = 0.00001
    test_list.append(cylinder_lowmach)

    ##########################
    ### Compressible RANS  ###
    ##########################

    # RAE2822 SA
    rae2822_sa           = TestCase('rae2822_sa')
    rae2822_sa.cfg_dir   = "rans/rae2822"
#.........這裏部分代碼省略.........
開發者ID:ADTG-VSSC,項目名稱:SU2,代碼行數:101,代碼來源:parallel_regression.py

示例14: testSetUpException

 def testSetUpException(self):
     self.test = TestCase("setUp")
     self.test.run(self.result)
     assert "1 run, 1 failed" == self.result.summary()
開發者ID:nathanh89,項目名稱:TDDPythonExample,代碼行數:4,代碼來源:TestCaseTest.py

示例15: __init__

	def __init__(self, name):
		self.wasRun = None
		TestCase.__init__(self, name)
開發者ID:glauberdm,項目名稱:xUnit,代碼行數:3,代碼來源:WasRun.py


注:本文中的TestCase.TestCase類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。