#! /usr/bin/env python

import os


def all_subpaths(path):
    """Return a list of all subpaths of given path

    The returned list will be in the order of [os.curdir, ... , '/']
    """
    path = os.path.abspath(path)
    head, _ = os.path.split(path)
    paths = []
    while head != '/':
        paths.append(head)
        head, _ = os.path.split(head)
    return paths


def all_subpaths_iter(path):
    """Return an iterator of all subpaths of given path

    The returned list will be in the order of [os.curdir, ... , '/']
    """
    path = os.path.abspath(path)
    head, _ = os.path.split(path)
    while head != '/':
        yield head
        head, _ = os.path.split(head)

@@ -148,33 +148,28 @@
 e order of %5B
-os.curdir
+path
 , ... , '/'%5D
@@ -202,32 +202,51 @@
 h.abspath(path)%0A
+    paths = %5Bpath%5D%0A
     head, _ = os
@@ -267,23 +267,8 @@
 th)%0A
-    paths = %5B%5D%0A
     
@@ -507,17 +507,12 @@
 of %5B
-os.curdir
+path
 , ..
@@ -557,24 +557,39 @@
 spath(path)%0A
+    yield path%0A
     head, _ 

Fix bug in path calculation, was skipping the path passed into the func