Skip to content

CI: Check for file leaks in _all_ tests #35711

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
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8eb547e
CI: avoid file leaks in sas_xport tests
jbrockmendel Aug 12, 2020
bd953bf
CLN: reuse context inside decorator
jbrockmendel Aug 12, 2020
c114449
TST: check for leaked socket connections
jbrockmendel Aug 12, 2020
e2e5043
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 12, 2020
c2a362c
open file later
jbrockmendel Aug 12, 2020
37902db
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 13, 2020
e75a15b
Fix incorrect file closing in read_sas
jbrockmendel Aug 13, 2020
f337be4
TST: make check_file_leaks an auto-use fixture for all tests
jbrockmendel Aug 12, 2020
6119a92
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 13, 2020
811b9d0
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 14, 2020
430567b
BUG: unclosed file handle in mmap
jbrockmendel Aug 14, 2020
1c3bf73
TST: close connections opened by sqlalchemy
jbrockmendel Aug 14, 2020
7aa2976
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 17, 2020
415294c
Move fixture to tests.io.conftest
jbrockmendel Aug 17, 2020
c701b6f
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 17, 2020
a74fe3d
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 17, 2020
6afb943
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel Aug 18, 2020
13f7540
Avoid sqlite file leak in ipython test
jbrockmendel Aug 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,13 @@ def ip():
pytest.importorskip("IPython", minversion="6.0.0")
from IPython.core.interactiveshell import InteractiveShell

return InteractiveShell()
# GH#35711 make sure sqlite history file handle is not leaked
from traitlets.config import Config

c = Config()
c.HistoryManager.hist_file = ":memory:"

return InteractiveShell(config=c)


@pytest.fixture(params=["bsr", "coo", "csc", "csr", "dia", "dok", "lil"])
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@

import pytest

import pandas.util._test_decorators as td

import pandas._testing as tm

from pandas.io.parsers import read_csv


@pytest.fixture(autouse=True)
def check_file_leaks():
"""
Check that a test does not leak file handles.
"""
with td.file_leak_context():
yield


@pytest.fixture
def tips_file(datapath):
"""Path to the tips dataset"""
Expand Down
2 changes: 0 additions & 2 deletions pandas/tests/io/excel/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ def test_read_from_pathlib_path(self, read_ext):
tm.assert_frame_equal(expected, actual)

@td.skip_if_no("py.path")
@td.check_file_leaks
def test_read_from_py_localpath(self, read_ext):

# GH12655
Expand All @@ -664,7 +663,6 @@ def test_read_from_py_localpath(self, read_ext):

tm.assert_frame_equal(expected, actual)

@td.check_file_leaks
def test_close_from_py_localpath(self, read_ext):

# GH31467
Expand Down