Esempio n. 1
0
 def test_get_files_in_dir_args(self):
     curdirlist = filetools.get_files_in_dir(os.curdir, ext="py", globexpr="*.py", sort=False)
     assert isinstance(curdirlist, list)
Esempio n. 2
0
import odysseus.filetools as filetools

dirname = 'datafiles'

# get all the names of files with extension .TIF, by default sorted by date
imgnames = filetools.get_files_in_dir(dirname)
print imgnames

# get all the names of python files
pythonnames = filetools.get_files_in_dir('..', globexpr='*.py', sort=False)
# sort files by date, newest first
pythonnames_sorted = filetools.sort_files_by_date(pythonnames,
                                                  newestfirst=True)

for pyname in pythonnames_sorted:
    print pyname
Esempio n. 3
0
 def test_get_files_in_dir_returntype(self):
     curdirlist = filetools.get_files_in_dir(os.curdir)
     assert isinstance(curdirlist, list)
Esempio n. 4
0
#!/usr/bin/env python
"""Run all examples in the example directory

If an example fails, an error is raised. This is useful when checking if
everything still works the way it is supposed to.

"""

import subprocess

import odysseus.filetools as filetools


dirname = '.'

# get all the names of python files
examples = filetools.get_files_in_dir('.', globexpr='example_*.py')

for example in examples:
    print '\n', 'running ', example
    retcode = subprocess.call(['python', example])

    if retcode:
        print '\n', 'An error occurred while running: '.upper(), example, '\n'
        raise RuntimeError





Esempio n. 5
0
#!/usr/bin/env python
"""Run all examples in the example directory

If an example fails, an error is raised. This is useful when checking if
everything still works the way it is supposed to.

"""

import subprocess

import odysseus.filetools as filetools

dirname = '.'

# get all the names of python files
examples = filetools.get_files_in_dir('.', globexpr='example_*.py')

for example in examples:
    print '\n', 'running ', example
    retcode = subprocess.call(['python', example])

    if retcode:
        print '\n', 'An error occurred while running: '.upper(), example, '\n'
        raise RuntimeError
Esempio n. 6
0
 def test_get_files_in_dir_args(self):
     curdirlist = filetools.get_files_in_dir(os.curdir, ext='py',
                                             globexpr='*.py', sort=False)
     assert isinstance(curdirlist, list)
Esempio n. 7
0
 def test_get_files_in_dir_returntype(self):
     curdirlist = filetools.get_files_in_dir(os.curdir)
     assert isinstance(curdirlist, list)
Esempio n. 8
0
import odysseus.filetools as filetools


dirname = 'datafiles'

# get all the names of files with extension .TIF, by default sorted by date
imgnames = filetools.get_files_in_dir(dirname)
print imgnames

# get all the names of python files
pythonnames = filetools.get_files_in_dir('..', globexpr='*.py', sort=False)
# sort files by date, newest first
pythonnames_sorted = filetools.sort_files_by_date(pythonnames, newestfirst=True)

for pyname in pythonnames_sorted:
    print pyname