def test_tag_delete(mark, parts):
    basename = parts[0]
    name = os.path.join(*parts)
    tagpath = Tag.path(name)
    os.makedirs(os.path.dirname(tagpath), exist_ok=True, mode=0o700)
    with open(Tag.path(name), "w") as f:
        f.write("My tag content")
    mark.tag_delete(basename)
    assert not os.path.exists(Tag.path(basename))
Exemple #2
0
def check_tag_file(name, n_paths):
    assert os.path.isfile(Tag.path(name)), f"Tag file {name} does not exist"
    with Tag(name, "r") as tag:
        paths = tag.read()
    assert len(paths) == n_paths
Exemple #3
0
def check_tag_file_not_exists(name):
    assert not os.path.exists(Tag.path(name))
Exemple #4
0
def create_tag_with_permission(name, mode):
    with Tag(name, read_only=False):
        pass
    path = Tag.path(name)
    os.chmod(path, 0o000)