Skip to content

Commit 7de9061

Browse files
test: improve ref count test (#846)
1 parent c52f0f2 commit 7de9061

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

local-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ flake8==3.9.2
55
flaky==3.7.0
66
mypy==0.902
77
objgraph==3.5.0
8-
pandas==1.2.4
98
Pillow==8.2.0
109
pixelmatch==0.2.3
1110
pre-commit==2.13.0

tests/test_reference_count_async.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# limitations under the License.
1414

1515
import gc
16+
from collections import defaultdict
1617

1718
import objgraph
18-
import pandas as pd
1919
import pytest
2020

2121
from playwright.async_api import async_playwright
@@ -42,11 +42,13 @@ async def test_memory_objects() -> None:
4242

4343
gc.collect()
4444

45-
df_dicts = pd.DataFrame()
46-
df_dicts["dicts"] = objgraph.by_type("dict")
47-
df_dicts["pw_types"] = df_dicts["dicts"].apply(lambda x: x.get("_type"))
45+
pw_objects = defaultdict(int)
46+
for o in objgraph.by_type("dict"):
47+
name = o.get("_type")
48+
if not name:
49+
continue
50+
pw_objects[name] += 1
4851

49-
head = df_dicts["pw_types"].value_counts().head(20)
50-
assert "Dialog" not in head.items()
51-
assert "Request" not in head.items()
52-
assert "Route" not in head.items()
52+
assert "Dialog" not in pw_objects
53+
assert "Request" not in pw_objects
54+
assert "Route" not in pw_objects

0 commit comments

Comments
 (0)