Beispiel #1
0
 def test_get_profile_path(self):
     import _vmprof
     tmpfile = open(self.tmpfilename, 'wb')
     assert _vmprof.get_profile_path() is None
     _vmprof.enable(tmpfile.fileno(), 0.01, 0, 0, 0, 0)
     path = _vmprof.get_profile_path()
     if path != tmpfile.name:
         with open(path, "rb") as fd1:
             assert fd1.read() == tmpfile.read()
     _vmprof.disable()
     assert _vmprof.get_profile_path() is None
Beispiel #2
0
def get_profile_path():
    """ Returns the absolute path for the file that is currently open.
        None is returned if the backend implementation does not implement that function,
        or profiling is not enabled.
    """
    if hasattr(_vmprof, 'get_profile_path'):
        return _vmprof.get_profile_path()
    raise NotImplementedError("get_profile_path not implemented on this platform")