def test_all_files(self):
        # Make three files to test against
        # Two that match and one that doesn't
        file_names = ['temp_file_one-tmp.tsc99', 
                      'temp_file_two-123tmp.tsc99', 
                      'temp_file_no_pattern.tsc99']
        for file_name in file_names:
            full_name = os.path.join(data_dir5, file_name)
            open(full_name, 'w').close()
        
        # Use generator to make a list
        pattern = '*tmp.tsc99'
        search_path = data_dir5
        file_found_list = list(fut.all_files(pattern, search_path))

        # Test to make sure there are only the two expected items in the list
        self.assertEquals(len(file_found_list), 2)
        
        # Remove testing files
        for file_name in file_names:
            full_name = os.path.join(data_dir5, file_name)
            os.remove(full_name)
Esempio n. 2
0
    def test_all_files(self):
        # Make three files to test against
        # Two that match and one that doesn't
        file_names = [
            'temp_file_one-tmp.tsc99', 'temp_file_two-123tmp.tsc99',
            'temp_file_no_pattern.tsc99'
        ]
        for file_name in file_names:
            full_name = os.path.join(data_dir5, file_name)
            open(full_name, 'w').close()

        # Use generator to make a list
        pattern = '*tmp.tsc99'
        search_path = data_dir5
        file_found_list = list(fut.all_files(pattern, search_path))

        # Test to make sure there are only the two expected items in the list
        self.assertEquals(len(file_found_list), 2)

        # Remove testing files
        for file_name in file_names:
            full_name = os.path.join(data_dir5, file_name)
            os.remove(full_name)
Esempio n. 3
0
'''\
__init__.py for filterpype.pypes package
'''

import filterpype.filter_utils as fut

__all__ = ['pypes_basic']

pypes_basic = dict(fut.pypes_for_dict_gen(fut.abs_dir_of_file(__file__)))
##print '**10542** Basic pypes', [key for key in pypes.iterkeys()]

if __name__ == '__main__':  #pragma: nocover
    print fut.all_files('*.pype', fut.abs_dir_of_file(__file__)).next()