Skip to content

Commit

Permalink
merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 6, 2024
2 parents ed1750f + 80af879 commit 6fe9be9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
if PY3:
import enum
else:
import unittest2 as unittest

enum = None

if POSIX:
Expand Down Expand Up @@ -986,9 +988,27 @@ def __call__(self, cls_or_meth):
pytest = fake_pytest


class PsutilTestCase(unittest.TestCase):
class TestCase(unittest.TestCase):
# ...otherwise multiprocessing.Pool complains
if not PY3:

def runTest(self):
pass

@contextlib.contextmanager
def subTest(self, *args, **kw):
# fake it for python 2.7
yield


# monkey patch default unittest.TestCase
unittest.TestCase = TestCase


class PsutilTestCase(TestCase):
"""Test class providing auto-cleanup wrappers on top of process
test utilities.
test utilities. All test classes should derive from this one, even
if we use pytest.
"""

def get_testfn(self, suffix="", dir=None):
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def test_leak_mem(self):
ls = []

def fun(ls=ls):
ls.append("x" * 124 * 1024)
ls.append("x" * 248 * 1024)

try:
# will consume around 60M in total
Expand Down

0 comments on commit 6fe9be9

Please sign in to comment.