call site 0 for path.local.__contains__
misc/testing/test_initpkg.py - line 83
81
82
83
   def check_import(modpath): 
       print "checking import", modpath
->     assert __import__(modpath) 
rest/testing/test_directive.py - line 11
1
2
3
4
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
42
43
44
45
46
47
48
   import py
   try:
       import docutils
   except ImportError:
       py.test.skip("docutils not present")
   
   from py.__.rest import directive
   from py.__.misc import rest
   from py.__.rest.latex import process_rest_file
   
-> datadir = py.magic.autopath().dirpath().join("data")
   testdir = py.test.ensuretemp("rest")
   
   class TestGraphviz(object):
       def _graphviz_html(self):
           if not py.path.local.sysfind("dot"):
               py.test.skip("graphviz needed")
           directive.set_backend_and_register_directives("html")
           if not py.path.local.sysfind("svn"):
               py.test.skip("svn needed")
           txt = datadir.join("graphviz.txt")
           html = txt.new(ext="html")
           png = datadir.join("example1.png")
           rest.process(txt)
           assert html.check()
           assert png.check()
           html_content = html.read()
           assert png.basename in html_content
           html.remove()
           png.remove()
           
       def _graphviz_pdf(self):
           if not py.path.local.sysfind("dot") or not py.path.local.sysfind("latex"):
               py.test.skip("graphviz and latex needed")
   
           directive.set_backend_and_register_directives("latex")
           txt = py.path.local(datadir.join("graphviz.txt"))
           pdf = txt.new(ext="pdf")
           dotpdf = datadir.join("example1.pdf")
           process_rest_file(txt)
           assert pdf.check()
           assert dotpdf.check()
           pdf.remove()
           dotpdf.remove()
   
       def test_graphviz(self):
           self._graphviz_html()
           self._graphviz_pdf()
magic/autopath.py - line 32
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