Skip to content

CI: test for file leakage #30162

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

Merged
merged 11 commits into from
Dec 11, 2019
2 changes: 1 addition & 1 deletion ci/deps/azure-36-locale_slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- lxml
- matplotlib=2.2.2
- numpy=1.14.*
- openpyxl=2.4.8
- openpyxl=2.5.7
- python-dateutil
- python-blosc
- pytz=2017.2
Expand Down
3 changes: 2 additions & 1 deletion ci/deps/azure-36-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ dependencies:
- pytest-xdist>=1.21
- hypothesis>=3.58.0
- pytest-azurepipelines
- psutil

# pandas dependencies
- beautifulsoup4=4.6.0
- bottleneck=1.2.1
- jinja2=2.8
- numexpr=2.6.2
- numpy=1.13.3
- openpyxl=2.4.8
- openpyxl=2.5.7
- pytables=3.4.2
- python-dateutil=2.6.1
- pytz=2017.2
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ gcsfs 0.2.2 Google Cloud Storage access
html5lib HTML parser for read_html (see :ref:`note <optional_html>`)
lxml 3.8.0 HTML parser for read_html (see :ref:`note <optional_html>`)
matplotlib 2.2.2 Visualization
openpyxl 2.4.8 Reading / writing for xlsx files
openpyxl 2.5.7 Reading / writing for xlsx files
pandas-gbq 0.8.0 Google Big Query access
psycopg2 PostgreSQL engine for sqlalchemy
pyarrow 0.12.0 Parquet and feather reading / writing
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ Optional libraries below the lowest tested version may still work, but are not c
+-----------------+-----------------+---------+
| matplotlib | 2.2.2 | |
+-----------------+-----------------+---------+
| openpyxl | 2.4.8 | |
| openpyxl | 2.5.7 | X |
+-----------------+-----------------+---------+
| pyarrow | 0.12.0 | X |
+-----------------+-----------------+---------+
Expand Down
2 changes: 1 addition & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"matplotlib": "2.2.2",
"numexpr": "2.6.2",
"odfpy": "1.3.0",
"openpyxl": "2.4.8",
"openpyxl": "2.5.7",
"pandas_gbq": "0.8.0",
"pyarrow": "0.12.0",
"pytables": "3.4.2",
Expand Down
24 changes: 24 additions & 0 deletions pandas/tests/io/excel/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

import pandas.util._test_decorators as td

import pandas.util.testing as tm

from pandas.io.parsers import read_csv
Expand Down Expand Up @@ -39,3 +41,25 @@ def read_ext(request):
Valid extensions for reading Excel files.
"""
return request.param


@pytest.fixture(autouse=True)
def check_for_file_leaks():
"""
Fixture to run around every test to ensure that we are not leaking files.

See also
--------
_test_decorators.check_file_leaks
"""
# GH#30162
psutil = td.safe_import("psutil")
if not psutil:
yield

else:
proc = psutil.Process()
flist = proc.open_files()
yield
flist2 = proc.open_files()
assert flist == flist2