Exemplo n.º 1
0
def test_constructorNoFiles( ):
    common.setupPath( __sourcePath1__ )
    common.setupPath( __sourcePath2__ )
    common.setupPath( __includePath1__ )
    common.setupPath( __includePath2__ )

    mgr = filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )
    assert not mgr.__modules__
    assert not mgr.__includeFiles__
Exemplo n.º 2
0
def test_createTestStubs( ):
    testRootPath = common.createTestPath( 'testRoot' )
    [ testModules, includeFiles ] = __setupTestFiles__( )

    mgr = filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )
    mgr.createTestStubs( testRootPath )

    for mod in testModules:
        assert os.path.exists( mod.testStubPath( testRootPath ) )
Exemplo n.º 3
0
def test_constructor( ):
    [ testModules, includeFiles ] = __setupTestFiles__( )

    mgr = filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )
    assert len( mgr.__modules__ ) == len( testModules )
    for mod in testModules:
        assert mod in mgr.__modules__  
        print( mod ) 
    
    assert len( mgr.__includeFiles__ ) == len( includeFiles )
    for file in includeFiles:
        assert file in mgr.__includeFiles__
Exemplo n.º 4
0
def test_createTestCMakeList( ):
    testRootPath = common.createTestPath( 'testRoot' )
    common.setupPath( testRootPath )
    [ testModules, includeFiles ] = __setupTestFiles__( )

    mgr = filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )
    mgr.createTestCMakeList( testRootPath )

    assert os.path.exists( os.path.join( testRootPath, 'CMakeLists.txt' ) )
    
    mgr.createTestCMakeList( testRootPath )

    assert os.path.exists( os.path.join( testRootPath, 'CMakeLists.txt' ) )
Exemplo n.º 5
0
def test_createTestStubsFileExists( ):
    testRootPath = common.createTestPath( 'testRoot' )
    common.setupPath( testRootPath )
    [ testModules, includeFiles ] = __setupTestFiles__( )
    for mod in testModules:
        os.makedirs( os.path.dirname( mod.testStubPath( testRootPath ) ) )
        common.touchFile( mod.testStubPath( testRootPath ) )

    mgr = filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )
    mgr.createTestStubs( testRootPath )

    for mod in testModules:
        assert os.path.exists( mod.testStubPath( testRootPath ) )
Exemplo n.º 6
0
#!/usr/bin/python3

import os
import sys

from unitygen import misc, filemgr, templates, config

if __name__ == "__main__":
    args = misc.parseArgs()

    configData = config.configfile(os.path.abspath(args.configFile))

    sources = configData.getSourcesRoots()
    includes = configData.getIncludeRoots()
    testRootPath = configData.getTestRoot()

    mgr = filemgr.filemgr(sources, includes)
    mgr.createTestStubs(testRootPath)
    mgr.createTestCMakeList(testRootPath)

    templates.generateTemplates(os.path.dirname(sys.argv[0]), testRootPath)
Exemplo n.º 7
0
def test_constructorNoIncludePath( ):
    common.setupPath( __sourcePath1__ )
    common.setupPath( __sourcePath2__ )
    
    with pytest.raises( Exception ):
        assert filemgr.filemgr( [ __sourcePath1__, __sourcePath2__ ], [ __includePath1__, __includePath2__ ] )