Skip to content
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

Flaky test: test_pytest_exit_returncode fails due to ResourceWarning #5088

Closed
blueyed opened this issue Apr 10, 2019 · 3 comments
Closed

Flaky test: test_pytest_exit_returncode fails due to ResourceWarning #5088

blueyed opened this issue Apr 10, 2019 · 3 comments
Labels
type: bug problem that needs to be addressed type: infrastructure improvement to development/releases/CI structure

Comments

@blueyed
Copy link
Contributor

blueyed commented Apr 10, 2019

_________________________ test_pytest_exit_returncode __________________________
[gw0] linux -- Python 3.5.3 /home/travis/build/pytest-dev/pytest/.tox/pypy3-xdist/bin/python
testdir = <Testdir local('/tmp/pytest-of-travis/pytest-0/popen-gw0/test_pytest_exit_returncode0')>
    def test_pytest_exit_returncode(testdir):
        testdir.makepyfile(
            """
            import pytest
            def test_foo():
                pytest.exit("some exit msg", 99)
        """
        )
        result = testdir.runpytest()
        result.stdout.fnmatch_lines(["*! *Exit: some exit msg !*"])
>       assert result.stderr.lines == [""]
E       assert ['Exception i...name=16>', ''] == ['']
E         At index 0 diff: "Exception ignored in: <_io.FileIO name=16 mode='wb' closefd=True>" != ''
E         Left contains 2 more items, first extra item: 'ResourceWarning: unclosed file <_io.BufferedWriter name=16>'
E         Use -v to get the full diff
/home/travis/build/pytest-dev/pytest/testing/test_runner.py:584: AssertionError
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.5.3[pypy-6.0.0-final], pytest-4.4.1.dev66+g482a0ba, py-1.8.0, pluggy-0.9.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/travis/build/pytest-dev/pytest/.hypothesis/examples')
rootdir: /tmp/pytest-of-travis/pytest-0/popen-gw0/test_pytest_exit_returncode0
plugins: xdist-1.28.0, forked-1.0.2, hypothesis-4.15.0
collected 1 item
test_pytest_exit_returncode.py 
========================= no tests ran in 0.61 seconds =========================
!!!!!!!!!!!!!!!!!!!!! _pytest.outcomes.Exit: some exit msg !!!!!!!!!!!!!!!!!!!!!
----------------------------- Captured stderr call -----------------------------
Exception ignored in: <_io.FileIO name=16 mode='wb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedWriter name=16>
=============================== warnings summary ===============================
testing/test_warnings.py:701
  /home/travis/build/pytest-dev/pytest/testing/test_warnings.py:701: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time
    testdir.copy_example("warnings/test_group_warnings_by_message.py")
-- Docs: https://docs.pytest.org/en/latest/warnings.html

https://travis-ci.org/pytest-dev/pytest/jobs/518502601#L5025
Python: pypy3.5-6.0
TOXENV=pypy3-xdist

@blueyed blueyed added type: bug problem that needs to be addressed type: infrastructure improvement to development/releases/CI structure labels Apr 10, 2019
@blueyed
Copy link
Contributor Author

blueyed commented Apr 13, 2019

@asottile
Copy link
Member

asottile commented Oct 7, 2019

looks like this has regressed

@nicoddemus
Copy link
Member

We have implemented a workaround in #7405 and decided to leave this closed for now, we can reopen this if someone wants to spend more time working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed type: infrastructure improvement to development/releases/CI structure
Projects
None yet
Development

No branches or pull requests

3 participants