Skip to content

Non-deterministic test failures #2065

Closed

Description

@mdboom

I've been seeing a lot of this semi-randomly lately:

__multicall__ = <MultiCall 0 results, 0 meths, kwargs={'pyfuncitem': <Function 'test_read_through_table_interface'>}>
pyfuncitem = <Function 'test_read_through_table_interface'>
    def pytest_pyfunc_call(__multicall__, pyfuncitem):
        if not __multicall__.execute():
            testfunction = pyfuncitem.obj
            if pyfuncitem._isyieldedfunction():
                testfunction(*pyfuncitem._args)
            else:
                funcargs = pyfuncitem.funcargs
                testargs = {}
                for arg in pyfuncitem._fixtureinfo.argnames:
>                   testargs[arg] = funcargs[arg]
E                   KeyError: 'tmpdir'

I think this has to do with the unicode literals testing functionality running the same test twice and "getting lucky" somehow.

Activity

  1. self-assigned this
    on Feb 7, 2014
  2. astrofrog commented on Feb 9, 2014

    @astrofrog
    Member

    I've seen this too - is it related to the parallel option?

  3. mdboom commented on Feb 10, 2014

    @mdboom
    ContributorAuthor

    I think it's most likely a bad interaction between the unicode literal double-testing and parallel testing, since the same test is run twice and (I think) there's a race condition between when the fixture arguments are setup and when the test is run.

  4. embray commented on Feb 14, 2014

    @embray
    Member

    Ditto on having seen this.

  5. mdboom commented on Feb 14, 2014

    @mdboom
    ContributorAuthor

    Have you seen it since #2060 was merged? I'm hoping that addresses this, but I was never able to reproduce locally, so I can't be certain.

  6. astrofrog commented on Mar 16, 2014

    @astrofrog
    Member

    I haven't seen this error since then. There is another error that comes from time to time related to some kind of race condition in importing astropy on the parallel builds, but this is different. I'll close this for now since the particular error mentioned above hasn't come up since.

  7. umasenthil commented on Apr 12, 2018

    @umasenthil

    I am seeing a similar error. It is due to parallel execution:
    pyfuncitem = <Function 'test_coxph'>

    @hookimpl(trylast=True)
    def pytest_pyfunc_call(pyfuncitem):
        testfunction = pyfuncitem.obj
        if pyfuncitem._isyieldedfunction():
            testfunction(*pyfuncitem._args)
        else:
            funcargs = pyfuncitem.funcargs
            testargs = {}
            for arg in pyfuncitem._fixtureinfo.argnames:
    
              testargs[arg] = funcargs[arg]
    

    E KeyError: 'flchain'

    ../../mypythonenv/lib/python3.6/site-packages/_pytest/python.py:154: KeyError
    It works if I run the same test sequentially

  8. drdavella commented on Apr 12, 2018

    @drdavella
    Contributor

    @umasenthil thanks for the report. What version of Python and astropy are you using?

  9. umasenthil commented on Apr 12, 2018

    @umasenthil

    @drdavella I am using Python 3.6.3. I am not using astropy. Will it help if I upgrade python version?
    Thanks

  10. drdavella commented on Apr 13, 2018

    @drdavella
    Contributor

    @umasenthil if this issue is unrelated to astropy, it would probably be best for you to report it directly to pytest at https://github.com/pytest-dev/pytest/.

  11. umasenthil commented on Apr 13, 2018

    @umasenthil

    @drdavella Will do. Thanks for the pointers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions