示例#1
0
 def test_exclude_dir(self):
     self.assertSequenceEqual(['first.po', 'second.po', 'library/lib1.po'],
                              process_path([],
                                           recursive=True,
                                           exclude_dir='venv'))
     self.assertSequenceEqual(['first.po', 'second.po', 'library/lib1.po'],
                              process_path([],
                                           recursive=True,
                                           exclude_dir='venv/'))
     self.assertSequenceEqual(['first.po', 'second.po', 'library/lib1.po'],
                              process_path([],
                                           recursive=True,
                                           exclude_dir='venv//'))
示例#2
0
def test_empty_and_recursive(few_files):
    assert set(process_path([], recursive=True)) == {
        "first.po",
        "second.po",
        "library/lib1.po",
        "venv/file1.po",
    }
示例#3
0
 def test_empty_and_recursive(self):
     self.assertSequenceEqual(
         ['first.po', 'second.po', 'library/lib1.po', 'venv/file1.po'],
         process_path([], recursive=True, exclude_dir=None))
示例#4
0
 def test_list_of_files(self):
     self.assertSequenceEqual(['file1.txt', 'file2.txt'],
                              process_path(['file1.txt', 'file2.txt'],
                                           recursive=False,
                                           exclude_dir=None))
示例#5
0
 def test_no_file(self):
     with self.assertRaises(SystemExit) as cm:
         process_path('non_exists_file.po',
                      recursive=False,
                      exclude_dir=None)
     self.assertEqual(cm.exception.code, 1)
示例#6
0
 def test_directory_and_no_recursion(self):
     with self.assertRaises(SystemExit) as cm:
         process_path('.', recursive=False, exclude_dir=None)
     self.assertEqual(cm.exception.code, 1)
示例#7
0
def test_list_of_files(few_files):
    assert set(process_path(["file1.txt", "file2.txt"], recursive=False)) == {
        "file1.txt",
        "file2.txt",
    }
示例#8
0
def test_no_file(few_files):
    with pytest.raises(SystemExit) as excinfo:
        process_path("non_exists_file.po", recursive=False)
    assert excinfo.value.code == 1
示例#9
0
def test_directory_and_no_recursion(few_files):
    with pytest.raises(SystemExit) as excinfo:
        process_path(".", recursive=False)
    assert excinfo.value.code == 1