Пример #1
0
def test_bundle_parse_directory_ignored_path(patch, bundle):
    patch.object(
        os,
        "walk",
        return_value=[(os.path.join(".", "root"), [], ["one.story"])],
    )
    patch.many(Bundle, ["gitignores", "ignores"])
    Bundle.gitignores.return_value = []
    Bundle.parse_directory("dir", ignored_path="ignored")
    Bundle.ignores.assert_called_with("ignored")
Пример #2
0
def test_bundle_parse_directory_gitignored(patch, bundle):
    """
    Ensures parse_directory does not return gitignored files
    """
    patch.object(os, 'walk', return_value=[('./root', [], ['one.story'])])
    patch.object(Bundle, 'gitignores')
    Bundle.gitignores.return_value = ['root/one.story']
    assert Bundle.parse_directory('dir') == []
Пример #3
0
def test_bundle_parse_directory(patch, bundle):
    """
    Ensures parse_directory can parse a directory
    """
    patch.object(os, 'walk', return_value=[('root', [], ['one.story', 'two'])])
    patch.object(Bundle, 'gitignores')
    result = Bundle.parse_directory('dir')
    assert Bundle.gitignores.call_count == 1
    os.walk.assert_called_with('dir')
    assert result == ['root/one.story']
Пример #4
0
def test_bundle_parse_directory(patch, bundle):
    """
    Ensures parse_directory can parse a directory
    """
    patch.object(os, "walk", return_value=[("root", [], ["one.story", "two"])])
    patch.object(Bundle, "gitignores")
    result = Bundle.parse_directory("dir")
    assert Bundle.gitignores.call_count == 1
    os.walk.assert_called_with("dir")
    assert result == [os.path.join("root", "one.story")]
Пример #5
0
def test_bundle_parse_directory_gitignored(patch, bundle):
    """
    Ensures parse_directory does not return gitignored files
    """
    patch.object(
        os,
        "walk",
        return_value=[(os.path.join(".", "root"), [], ["one.story"])],
    )
    patch.object(Bundle, "gitignores")
    Bundle.gitignores.return_value = [os.path.join("root", "one.story")]
    assert Bundle.parse_directory("dir") == []
Пример #6
0
def test_bundle_parse_directory_ignored_path(patch, bundle):
    patch.object(os, 'walk', return_value=[('./root', [], ['one.story'])])
    patch.many(Bundle, ['gitignores', 'ignores'])
    Bundle.gitignores.return_value = []
    Bundle.parse_directory('dir', ignored_path='ignored')
    Bundle.ignores.assert_called_with('ignored')