call site 12 for path.local.__cmp__
apigen/testing/test_apigen_functional.py - line 130
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
   def test_apigen_functional():
       #if py.std.sys.platform == "win32":
       #    py.test.skip("XXX test fails on windows")
       fs_root, package_name = setup_fs_project('test_apigen_functional')
       tempdir = py.test.ensuretemp('test_apigen_functional_results')
->     pydir = py.magic.autopath().dirpath().dirpath().dirpath()
       pakdir = fs_root.join('pak')
       if py.std.sys.platform == 'win32':
           cmd = ('set APIGENPATH=%s && set PYTHONPATH=%s && '
                  'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
       else:
           cmd = ('APIGENPATH="%s" PYTHONPATH="%s" '
                  'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
       try:
           output = py.process.cmdexec('%s --apigen="%s/apigen.py" "%s"' % (
                                           cmd, fs_root, pakdir))
       except py.error.Error, e:
           print e.out
           raise
       assert output.lower().find('traceback') == -1
   
       # just some quick content checks
       apidir = tempdir.join('api')
       assert apidir.check(dir=True)
       sometestclass_api = apidir.join('main.SomeTestClass.html')
       assert sometestclass_api.check(file=True)
       html = sometestclass_api.read()
       print html
       assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html
       assert 'someattr: <em>somevalue</em>' in html
       
       namespace_api = apidir.join('main.html')
       assert namespace_api.check(file=True)
       html = namespace_api.read()
       assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html
       index = apidir.join('index.html')
       assert index.check(file=True)
       html = index.read()
       assert 'pkg docstring' in html
   
       sourcedir = tempdir.join('source')
       assert sourcedir.check(dir=True)
       sometestclass_source = sourcedir.join('sometestclass.py.html')
       assert sometestclass_source.check(file=True)
       html = sometestclass_source.read()
       assert '<div class="project_title">sources for sometestclass.py</div>' in html
   
       index = sourcedir.join('index.html')
       assert index.check(file=True)
       html = index.read()
       print html
       assert '<a href="test/index.html">test</a>' in html
       assert 'href="../../py/doc/home.html"'
magic/autopath.py - line 35
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
   def autopath(globs=None, basefile='__init__.py'):
       """ return the (local) path of the "current" file pointed to by globals
           or - if it is none - alternatively the callers frame globals.
   
           the path will always point to a .py file  or to None.
           the path will have the following payload:
           pkgdir   is the last parent directory path containing 'basefile'
                    starting backwards from the current file.
       """
       if globs is None:
           globs = sys._getframe(1).f_globals
       try:
           __file__ = globs['__file__']
       except KeyError:
           if not sys.argv[0]:
               raise ValueError, "cannot compute autopath in interactive mode"
           __file__ = os.path.abspath(sys.argv[0])
   
       custom__file__ = isinstance(__file__, PathStr)
       if custom__file__:
           ret = __file__.__path__
       else:
           ret = local(__file__)
           if ret.ext in ('.pyc', '.pyo'):
               ret = ret.new(ext='.py')
       current = pkgdir = ret.dirpath()
       while 1:
           if basefile in current:
               pkgdir = current
               current = current.dirpath()
->             if pkgdir != current:
                   continue
           elif not custom__file__ and str(current) not in sys.path:
               sys.path.insert(0, str(current))
           break
       ret.pkgdir = pkgdir
       return ret