Skip to content

Commit

Permalink
revert change which broke python 2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Oct 6, 2024
1 parent 4e85bee commit 80af879
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
22 changes: 20 additions & 2 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,27 @@ def get_testfn(suffix="", dir=None):
# ===================================================================


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 @@ -398,7 +398,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
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"pytest-xdist",
"pytest==4.6.11",
"setuptools",
"unittest2",
]
if WINDOWS and not PYPY:
TEST_DEPS.append("pywin32")
Expand Down

0 comments on commit 80af879

Please sign in to comment.