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

tests fails because of unclosed file handlers #898

Open
gaborbernat opened this Issue Jul 10, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@gaborbernat
Member

gaborbernat commented Jul 10, 2018

We ran into this today with one of our CI envs (Python 3.4).

=================================== FAILURES ===================================
____________ TestConfigTestEnv.test_default_factors_conflict_ignore ____________
self = <test_config.TestConfigTestEnv object at 0x7f2c8d388d68>
newconfig = <function create_new_config_file.<locals>.create_new_config_file_ at 0x7f2c8d361400>
capsys = <_pytest.capture.CaptureFixture object at 0x7f2c8d388e48>
    def test_default_factors_conflict_ignore(self, newconfig, capsys):
        with pytest.warns(None) as record:
            config = newconfig(
                """
                    [tox]
                    ignore_basepython_conflict=True
                    [testenv]
                    basepython=python3
                    [testenv:py27]
                    commands = python --version
                """
            )
        assert len(config.envconfigs) == 1
        envconfig = config.envconfigs["py27"]
        assert envconfig.basepython == "python2.7"
>       assert len(record) == 0, "\n".join(repr(r.message) for r in record)
E       AssertionError: ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_develop_extras0/.tox/python/log/python-1.log' mode='w' encoding='UTF-8'>",)
E         ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_develop_extras0/.tox/python/log/python-0.log' mode='w' encoding='UTF-8'>",)
E         ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_dep_recreation0/.tox/python/log/python-1.log' mode='w' encoding='UTF-8'>",)
E         ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_dep_recreation0/.tox/python/log/python-0.log' mode='w' encoding='UTF-8'>",)
E         ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_pythonpath_usage0/.tox/python/log/python-0.log' mode='w' encoding='UTF-8'>",)
E         ResourceWarning("unclosed file <_io.TextIOWrapper name='/tmp/pytest-of-travis/pytest-0/test_pythonpath_usage0/.tox/python/log/python-1.log' mode='w' encoding='UTF-8'>",)
E       assert 6 == 0
E        +  where 6 = len(WarningsChecker(record=True))
capsys     = <_pytest.capture.CaptureFixture object at 0x7f2c8d388e48>
config     = <tox.config.Config object at 0x7f2c8d388438>
envconfig  = <tox.config.TestenvConfig object at 0x7f2c8d3737f0>
newconfig  = <function create_new_config_file.<locals>.create_new_config_file_ at 0x7f2c8d361400>
record     = WarningsChecker(record=True)
self       = <test_config.TestConfigTestEnv object at 0x7f2c8d388d68>
/home/travis/build/tox-dev/tox/tests/test_config.py:1672: AssertionError
- generated xml file: /home/travis/build/tox-dev/tox/.tox/test-results.py.xml --
@gaborbernat

This comment has been minimized.

Show comment
Hide comment
@gaborbernat

gaborbernat Sep 18, 2018

Member

The problem is python 3.4/3.5 only and random to appear, so hard to replicate/identify.

Member

gaborbernat commented Sep 18, 2018

The problem is python 3.4/3.5 only and random to appear, so hard to replicate/identify.

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