def test_inaccessible_directories(self): """ Inaccessible directories should be silently ignored """ directory = tempfile.mkdtemp() accessible = os.path.join(directory, 'accessible') inaccessible = os.path.join(directory, 'inaccessible') os.mkdir(accessible, 511) os.mkdir(inaccessible, 000) with open(os.path.join(accessible, 'main.fmf'), 'w') as main: main.write('key: value\n') Tree.init(directory) tree = Tree(directory) assert tree.find('/accessible').get('key') == 'value' assert tree.find('/inaccessible') is None os.chmod(inaccessible, 511) rmtree(directory)
def test_tree_commit(self, tmpdir): # Tag node = Tree.node(dict(url=FMF_REPO, ref='0.12')) assert node.commit == '6570aa5f10729991625d74036473a71f384d745b' # Hash node = Tree.node(dict(url=FMF_REPO, ref='fa05dd9')) assert 'fa05dd9' in node.commit assert 'fa05dd9' in node.commit # return already detected value # Data node = Tree(dict(x=1)) assert node.commit is False # No git repository tree = Tree(Tree.init(str(tmpdir))) assert tree.commit is False