PageRenderTime 55ms CodeModel.GetById 48ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/galaxy/tools/deps/tests.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 33 lines | 20 code | 11 blank | 2 comment | 3 complexity | 7aaf56edb4900e5d59b2e569ad632ee4 MD5 | raw file
 1import tempfile
 2import os.path
 3from os import makedirs, mkdir
 4import galaxy.tools.deps
 5
 6def touch( fname, data=None ):
 7    f = open( fname, 'w' )
 8    if data:
 9        f.write( data )
10    f.close()
11
12def test():
13
14    # Setup directories
15    base_path = tempfile.mkdtemp()
16    # mkdir( base_path )
17    for name, version in [ ( "dep1", "1.0" ), ( "dep1", "2.0" ), ( "dep2", "1.0" ) ]:
18        p = os.path.join( base_path, name, version ) 
19        try:
20            makedirs( p )
21        except:
22            pass
23        touch( os.path.join( p, "env.sh" ) )
24
25    dm = galaxy.tools.deps.DependencyManager( [ base_path ] )
26
27    print dm.find_dep( "dep1", "2.0" )
28
29    
30
31
32
33