예제 #1
0
 def resolve_from_dir(node: DirectoryInfo):
     init = node.get_fileinfo('__init__.py')
     if init.is_file():
         store['pkg_root'] = init.path
         pkg_parts.append(node.path.name)
         name_parts.append(node.path.name)
         resolve_from_dir(node.get_parent())
예제 #2
0
 def _find_pipfile(dir: DirectoryInfo, deep: int):
     if deep == 0:
         return None
     pf = dir.get_fileinfo('Pipfile')
     if pf.is_file():
         return pf.path
     return _find_pipfile(dir.get_parent(), deep - 1)
예제 #3
0
def test_node_get_parent_posix():
    # parent of root is None
    top_dir = DirectoryInfo('/')
    assert top_dir.get_parent() is None