Пример #1
0
    class TestCase( unittest.TestCase ):
        # def __init__( self ):
            # unittest.TestCase.__init__( self )

        def setUp( self ):
            os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", project ) )
            self.__shell = Shell()
            self.__shell.execute( [ "test", "--silent", "--buildkit", bkName, "make" ] )
            self.__targets = set()
            for source in whatIfs:
                for target in whatIfs[ source ]:
                    self.__targets.add( target )
    
        def testMake( self ):
            for target in self.__targets:
                self.assertTrue( os.path.exists( target ), project + " " + target )

        def testWhatIf( self ):
            for source in whatIfs:
                before = dict()
                for target in self.__targets:
                    before[ target ] = os.stat( target ).st_mtime
                self.__shell.execute( [ "test", "--buildkit", bkName, "make", "--touch", "--new-file", source ] )
                after = dict()
                for target in self.__targets:
                    after[ target ] = os.stat( target ).st_mtime

                updatedTargets = set()
                for target in self.__targets:
                    if after[ target ] != before[ target ]:
                        updatedTargets.add( target )
                self.assertEquals( updatedTargets, set( whatIfs[source] ), project + " " + source + " " + str( updatedTargets ) + " != " + str( whatIfs[source] ) )
Пример #2
0
 def test( self ):
     os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", "CompilationError" ) )
     shutil.rmtree( "build", True )
     shell = Shell()
     shell.execute( [ "test", "--silent", "--buildkit", bkName, "make", "-k" ] )
     time.sleep( 0.5 )
     self.assertFalse( os.path.exists( cppObjFile( "a" ) ) )
     self.assertTrue( os.path.exists( cppObjFile( "b" ) ) )
     self.assertTrue( os.path.exists( cppObjFile( "c" ) ) )
     self.assertTrue( os.path.exists( cppObjFile( "d" ) ) )
     self.assertTrue( os.path.exists( cppObjFile( "e" ) ) )
     self.assertTrue( os.path.exists( cppObjFile( "main" ) ) )
     self.assertFalse( os.path.exists( exeFile( "hello" ) ) )