[py-dev] bug in py.test.collect

Ralf Schmitt schmir at gmail.com
Mon Jul 7 07:56:29 CEST 2008


I got the following traceback, when running py.test on one of my test files.
I haven't investigated any further...

____________________________ entrypoint: TestEnv() _____________________________

    def runtraced(self, colitem):
        if self.shouldclose():
            raise Exit, "received external close signal"

        outcome = None
        colitem.startcapture()
        try:
            self.start(colitem)
            try:
                try:
                    if colitem._stickyfailure:
                        raise colitem._stickyfailure
>                   outcome = self.run(colitem)

[/home/ralf/py26/lib/python2.6/site-packages/py/test/session.py:84]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def run(self, colitem):
        if self.config.option.collectonly and isinstance(colitem,
py.test.collect.Item):
            return
        if isinstance(colitem, py.test.collect.Item):
            colitem._skipbykeyword(self.config.option.keyword)
>       res = colitem.run()

[/home/ralf/py26/lib/python2.6/site-packages/py/test/session.py:107]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def run(self):
>       self._prepare()

[/home/ralf/py26/lib/python2.6/site-packages/py/test/collect.py:336]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _prepare(self):
        if not hasattr(self, '_name2items'):
            ex = getattr(self, '_name2items_exception', None)
            if ex is not None:
                raise ex[0], ex[1], ex[2]
            try:
>               self._name2items = self._buildname2items()

[/home/ralf/py26/lib/python2.6/site-packages/py/test/collect.py:328]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _buildname2items(self):
        # NB. we avoid random getattrs and peek in the __dict__ instead
        d = {}
>       dicts = [getattr(self.obj, '__dict__', {})]

[/home/ralf/py26/lib/python2.6/site-packages/py/test/collect.py:298]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def fget(self):
        try:
            return self._obj
        except AttributeError:
>           self._obj = obj = self._getobj()

[/home/ralf/py26/lib/python2.6/site-packages/py/test/collect.py:105]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _getobj(self):
E       return self.parent.obj()
>       TypeError: __init__() takes exactly 2 arguments (1 given)

[/home/ralf/py26/lib/python2.6/site-packages/py/test/collect.py:436]



More information about the Pytest-dev mailing list