Ejemplo n.º 1
0
 def test_one_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/scripts')
     self.assertEqual(get_file_or_folder_paths(content), [
         '/scripts',
         '/scripts/makemoney.sh',
     ])
Ejemplo n.º 2
0
 def test_empty_folder_and_file_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/emptyfolder')
     content.add_path('/tmp/DukeDsClientTestFolder/note.txt')
     self.assertEqual(get_file_or_folder_paths(content), [
         '/emptyfolder',
         '/note.txt'
     ])
Ejemplo n.º 3
0
 def test_nested_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/results')
     self.assertEqual(('project: [folder:results ['
                        'file:result1929.txt, '
                        'file:result2929.txt, '
                        'folder:subresults [file:result1002.txt, file:result13.txt, file:result15.txt], '
                        'folder:subresults2 []'
                        ']]'), str(content))
Ejemplo n.º 4
0
 def test_nested_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/results')
     self.assertEqual(get_file_or_folder_paths(content), [
         '/results',
         '/results/result1929.txt',
         '/results/result2929.txt',
         '/results/subresults',
         '/results/subresults/result1002.txt',
         '/results/subresults/result13.txt',
         '/results/subresults/result15.txt',
         '/results/subresults2',
     ])
Ejemplo n.º 5
0
 def test_big_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder')
     self.assertEqual(('project: [folder:DukeDsClientTestFolder ['
                        'file:note.txt, '
                        'folder:emptyfolder [], '
                        'folder:results ['
                        'file:result1929.txt, file:result2929.txt, folder:subresults '
                        '[file:result1002.txt, file:result13.txt, file:result15.txt], '
                        'folder:subresults2 []'
                        '], '
                        'folder:scripts ['
                        'file:makemoney.sh'
                        ']'
                        ']]'), str(content))
Ejemplo n.º 6
0
 def test_ignore_one_dir(self):
     with open("/tmp/DukeDsClientTestFolder/.ddsignore", "w") as text_file:
         text_file.write("emptyfolder")
     content = LocalProject(False, file_exclude_regex='^\.')
     content.add_path('test_scripts')
     self.assertNotIn('.hidden_file', str(content))
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder')
     child_names = [child.name for child in content.children[0].children]
     self.assertEqual(set(['.ddsignore', 'note.txt', 'results', 'scripts']),
                      set(child_names))
Ejemplo n.º 7
0
 def test_big_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder')
     child_names = [child.name for child in content.children[0].children]
     self.assertEqual(set(['note.txt', 'emptyfolder', 'results', 'scripts']), set(child_names))
     self.assertEqual(get_file_or_folder_paths(content), [
         '/DukeDsClientTestFolder',
         '/DukeDsClientTestFolder/emptyfolder',
         '/DukeDsClientTestFolder/note.txt',
         '/DukeDsClientTestFolder/results',
         '/DukeDsClientTestFolder/results/result1929.txt',
         '/DukeDsClientTestFolder/results/result2929.txt',
         '/DukeDsClientTestFolder/results/subresults',
         '/DukeDsClientTestFolder/results/subresults/result1002.txt',
         '/DukeDsClientTestFolder/results/subresults/result13.txt',
         '/DukeDsClientTestFolder/results/subresults/result15.txt',
         '/DukeDsClientTestFolder/results/subresults2',
         '/DukeDsClientTestFolder/scripts',
         '/DukeDsClientTestFolder/scripts/makemoney.sh'
     ])
Ejemplo n.º 8
0
 def test_big_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder')
     child_names = [child.name for child in content.children[0].children]
     self.assertEqual(
         set(['note.txt', 'emptyfolder', 'results', 'scripts']),
         set(child_names))
     self.assertEqual(
         ('project: [folder:DukeDsClientTestFolder ['
          'file:note.txt, '
          'folder:emptyfolder [], '
          'folder:results ['
          'file:result1929.txt, file:result2929.txt, folder:subresults '
          '[file:result1002.txt, file:result13.txt, file:result15.txt], '
          'folder:subresults2 []'
          '], '
          'folder:scripts ['
          'file:makemoney.sh'
          ']'
          ']]'), str(content))
Ejemplo n.º 9
0
 def test_ignore_one_dir(self):
     with open("/tmp/DukeDsClientTestFolder/.ddsignore", "w") as text_file:
         text_file.write("emptyfolder")
     content = LocalProject(False, file_exclude_regex='^\.')
     content.add_path('test_scripts')
     self.assertNotIn('.hidden_file', str(content))
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder')
     child_names = [child.name for child in content.children[0].children]
     self.assertEqual(set(['.ddsignore', 'note.txt', 'results', 'scripts']), set(child_names))
Ejemplo n.º 10
0
 def test_one_folder_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/scripts')
     self.assertEqual('project: [folder:scripts [file:makemoney.sh]]', str(content))
Ejemplo n.º 11
0
 def test_empty_folder_and_file_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/emptyfolder')
     content.add_path('/tmp/DukeDsClientTestFolder/note.txt')
     self.assertEqual('project: [folder:emptyfolder [], file:note.txt]', str(content))
Ejemplo n.º 12
0
 def test_top_level_file_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     content.add_path('/tmp/DukeDsClientTestFolder/note.txt')
     self.assertEqual('project: [file:note.txt]', str(content))
Ejemplo n.º 13
0
 def test_empty_str(self):
     content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
     self.assertEqual('project: []', str(content))
Ejemplo n.º 14
0
 def test_exclude_dot_files(self):
     content = LocalProject(False, file_exclude_regex='^\.')
     content.add_path('test_scripts')
     self.assertNotIn('.hidden_file', str(content))
Ejemplo n.º 15
0
 def test_exclude_dot_files(self):
     content = LocalProject(False, file_exclude_regex='^\.')
     content.add_path('test_scripts')
     self.assertNotIn('/test_scripts/.hidden_file', get_file_or_folder_paths(content))
Ejemplo n.º 16
0
 def _load_local_project(folders, follow_symlinks, file_exclude_regex):
     local_project = LocalProject(followsymlinks=follow_symlinks,
                                  file_exclude_regex=file_exclude_regex)
     local_project.add_paths(folders)
     return local_project