Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41af4f0

Browse files
committed
Avoid using tracemalloc in PyPy, seems to be broken there.
1 parent 2278eb7 commit 41af4f0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@
7171
import getopt
7272
import unittest
7373
import traceback
74-
import tracemalloc
74+
75+
try:
76+
import tracemalloc
77+
except ImportError:
78+
tracemalloc = None
7579

7680
from unittest import TextTestResult
7781

@@ -550,7 +554,8 @@ def main(argv):
550554
cov = Coverage(omit=['test.py'])
551555

552556
# Configure tracemalloc.
553-
tracemalloc.start()
557+
if tracemalloc is not None:
558+
tracemalloc.start()
554559

555560
# Finding and importing
556561
test_files = get_test_files(cfg)

0 commit comments

Comments
 (0)