[pytest-dev] Weird backtrace involving py/_code/source.py

Nikolaus Rath Nikolaus at rath.org
Tue Jun 3 04:32:45 CEST 2014


Hello,

I am trying to debugging a rather peculiar failure of one of my test
cases. I nailed it down to a function being called by a thread that
shouldn't be calling it, and without any apparent caller.

When I set a breakpoint in the function using pdb, I get the following
traceback:

> /home/nikratio/in-progress/s3ql/src/dugong/__init__.py(1249)disconnect()
-> if self._sock:
(Pdb) bt
  /home/nikratio/in-progress/s3ql/src/s3ql/backends/common.py(1050)close()
-> self.fh.close()
  /home/nikratio/in-progress/s3ql/src/s3ql/backends/s3c.py(686)close()
-> self.backend.conn.disconnect()
> /home/nikratio/in-progress/s3ql/src/dugong/__init__.py(1249)disconnect()
-> if self._sock:
(Pdb) bt

Suffice to say that there should be no thread that starts running in
common.py:1050. I was mystified.


I then tried to look at the same call stack in Eclipse using
PyDev. Here, I got several additional entries. I put a screenshot on
http://www.rath.org/res/Eclipse.png.

It seems that somehow my function gets called from
getstatementrange_ast() in py/_code/source.py, and from there on upwards
its only py.test and py related files.

Does this make any sense to anyone? Why is py calling into random places
in my code?

I am using assertion rewriting.


Best,
Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Pytest-dev mailing list