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

WIP: Debug ResourceWarnings BufferedRandom #44877

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4f164f5
WIP: Debug ResourceWarnings BufferedRandom
mroeschke Dec 14, 2021
9d23ff4
Restrict to file numbers, fix match to search
mroeschke Dec 14, 2021
a59e076
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 15, 2021
9038eee
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 16, 2021
b0cc40c
Mock FT2Font object that doesn't close file
mroeschke Dec 17, 2021
580e11c
Try writing to a in memory file
mroeschke Dec 17, 2021
b925040
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 17, 2021
131369a
Only check in plotting tests
mroeschke Dec 17, 2021
113c108
Try patching without importing
mroeschke Dec 18, 2021
8236f51
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 18, 2021
c273204
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 21, 2021
83daa1b
Try clearing cache
mroeschke Dec 21, 2021
473f0f6
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 21, 2021
d56c308
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 22, 2021
8d46016
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 22, 2021
60682c8
Just run plotting tests to be sure
mroeschke Dec 22, 2021
60b2007
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 23, 2021
82efb57
Run everything again
mroeschke Dec 23, 2021
14f2f4e
Check if lsof printing stuff
mroeschke Dec 23, 2021
9fe484d
lsof check globally again
mroeschke Dec 23, 2021
9ccff0d
Clear cache in another matplotlib test
mroeschke Dec 24, 2021
5bc96ae
Found another matplotlib test in pandas/tests/io/formats/test_to_exce…
mroeschke Dec 24, 2021
ea74b7c
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 24, 2021
c7faf30
Try clearing if matplotlib in sys modules
mroeschke Dec 25, 2021
1514f18
Merge remote-tracking branch 'upstream/master' into debug/resourcewar…
mroeschke Dec 25, 2021
dcbbea2
See what command raises on windows
mroeschke Dec 26, 2021
6f6fe4a
Silence all lsof fixture
mroeschke Dec 26, 2021
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
2 changes: 1 addition & 1 deletion ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
XVFB="xvfb-run "
fi

PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"
PYTEST_CMD="${XVFB}pytest -v -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE $PYTEST_TARGET"

if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then
PYTEST_CMD="$PYTEST_CMD --ignore=pandas/tests/plotting/"
Expand Down
19 changes: 17 additions & 2 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
- Dtypes
- Misc
"""
# pyright: reportUntypedFunctionDecorator = false

from collections import abc
from datetime import (
date,
Expand All @@ -30,6 +28,9 @@
from decimal import Decimal
import operator
import os
import re
import subprocess
import sys

from dateutil.tz import (
tzlocal,
Expand Down Expand Up @@ -199,6 +200,20 @@ def add_imports(doctest_namespace):
doctest_namespace["pd"] = pd


pat = re.compile(r"(0?[1-9]|1[0-9]|2[0-5])u")


@pytest.fixture(autouse=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just enable for pandas.tests.io?

def check_bufferedrandom_resourcewarning():
yield
lsof = subprocess.run(["lsof"], capture_output=True).stdout.decode("utf-8")
for line in lsof.split("\n"):
if re.match(pat, line):
# sys.stderr for xdist
# https://github.com/pytest-dev/pytest/issues/1693#issuecomment-233282644
print(line, flush=True, file=sys.stderr)


# ----------------------------------------------------------------
# Common arguments
# ----------------------------------------------------------------
Expand Down