Skip to content

AttributeError: 'SlaveController' object has no attribute 'slaveoutput' #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ionelmc opened this issue Oct 16, 2015 · 8 comments
Closed

Comments

@ionelmc
Copy link
Member

ionelmc commented Oct 16, 2015

I got this weird error with 1.6:

Traceback (most recent call last):
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
    doit(config, session)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
    return self._docall(self.methods, kwargs)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
    firstresult=self.firstresult).execute()
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
    res = method(*args)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/xdist/dsession.py", line 521, in pytest_runtestloop
    self.loop_once()
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/xdist/dsession.py", line 539, in loop_once
    call(**kwargs)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/xdist/dsession.py", line 582, in slave_errordown
    self.config.hook.pytest_testnodedown(node=node, error=error)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
    return self._docall(self.methods, kwargs)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
    firstresult=self.firstresult).execute()
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
    res = method(*args)
  File "/var/lib/jenkins/virtenv/428e316eff82784c964740c18463dd91/lib/python2.7/site-packages/pytest_html/plugin.py", line 61, in pytest_testnodedown
    node.config._environment = node.slaveoutput['environment']
AttributeError: 'SlaveController' object has no attribute 'slaveoutput'

Any idea what's going on?

@davehunt
Copy link
Collaborator

It could be that you don't have pytest-xdist installed. It shouldn't be required, but I thought pytest_testnodedown was only called if it was. We may be able to just guard against this by checking for this attribute before https://github.com/davehunt/pytest-html/blob/master/pytest_html/plugin.py#L61 like we do at https://github.com/davehunt/pytest-html/blob/master/pytest_html/plugin.py#L53

@The-Compiler
Copy link
Member

This is odd - pytest_testnodedown is indeed defined in xdist's newhooks.py, and SlaveController is a class from xdist as well.

@ionelmc
Copy link
Member Author

ionelmc commented Oct 16, 2015

I'm pretty sure I had xdist installed. Might be something else?

@The-Compiler
Copy link
Member

From xdist:

class SlaveController(object):

    ...

    def process_from_remote(self, eventcall):
        """ this gets called for each object we receive from
            the other side and if the channel closes.

            Note that channel callbacks run in the receiver
            thread of execnet gateways - we need to
            avoid raising exceptions or doing heavy work.
        """
        try:
            ...
            elif eventname == "slavefinished":
                self._down = True
                self.slaveoutput = kwargs['slaveoutput']
                self.notify_inproc("slavefinished", node=self)
            ...

So I think SlaveController not having slaveoutput means the slave never finished properly?

I'm guessing this happens when the slave crashes in some way, so I guess checking for that attribute is the way to go.

@ionelmc
Copy link
Member Author

ionelmc commented Oct 16, 2015

Well, I did have some other failures in that jenkins build ... sounds like that might be the problem.

@RonnyPfannschmidt
Copy link
Member

one can acceptance test for this with a unittest that calls os._exit(0)
i think it should be solved from the xdist side as well (better docs about the node object state)

@davehunt
Copy link
Collaborator

Fix has been reverted due to issues with pytest 2.8.x and Python 2.x

@davehunt davehunt reopened this Oct 19, 2015
@davehunt
Copy link
Collaborator

I relanded but xfailed the problematic test.

drRedflint added a commit to drRedflint/pytest-html that referenced this issue Oct 25, 2022
* make filter search case insensitive

* use sessionStorage to prevent preferences to be reapplied on new reports

* avoid multiple event bindings + fix filter bug

* fix sort bug

* Collapse individual row

Co-authored-by: Jim Brännlund <[email protected]>
BeyondEvil added a commit that referenced this issue Mar 5, 2023
* fix main.js conflicts

* fix js test

* fix resource (main.js) test

* revert change to report extra

* filters style

* css and dom brush up

* Buildable app

* always store data in html

* Always store data blob in file

* json dump test data

* read data from dom element

* manually initialize state

* minimalistic dataset

* simplify included files

* Handle report extras

* Handle python report hooks

* imgviewer

* present name in image viewer and open img on click

* setup linter for project

* conform to styles

* show video in imageviewer (#14)

* show video in imageviewer

* Chore: Pluralize extra (#15)

* Add extras.HTML

* Move outcome handling to backend (#18)

* Move outcome handling to backend

* Pass in text version of longrepr if present

* make collapse/expand all functional (#20)

* make collapse/expand all functional

* only create links for text, url and json (#22)

* make filter search case insensitive (#21)

* make filter search case insensitive

* use sessionStorage to prevent preferences to be reapplied on new reports

* avoid multiple event bindings + fix filter bug

* Collapse individual row

Co-authored-by: Jim Brännlund <[email protected]>

* add no log output captured string

* Query params (#25)

* Add query params

* adjust tests (#26)

* Duration format (#27)

* adjust tests

* build format handler

* remove dependency

---------

Co-authored-by: Jim Brännlund <[email protected]>

* Beyondevil/cleanup (#28)

* chore: Cleanup branch before merge

* chore: Fix duration and CI

* Fix pre-commit issues

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Viktor Gustafsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants