summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/dispatch/tests.py4
-rwxr-xr-xtests/runtests.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/dispatch/tests.py b/tests/dispatch/tests.py
index 2cd7bc8094..8e72e626dd 100644
--- a/tests/dispatch/tests.py
+++ b/tests/dispatch/tests.py
@@ -1,13 +1,13 @@
import gc
-import sys
import weakref
from types import TracebackType
from django.dispatch import Signal, receiver
from django.test import SimpleTestCase
from django.test.utils import override_settings
+from django.utils.version import PYPY
-if hasattr(sys, "pypy_version_info"):
+if PYPY:
def garbage_collect():
# Collecting weakreferences can take two collections on PyPy.
diff --git a/tests/runtests.py b/tests/runtests.py
index 48beb1a3d7..1e3d15591f 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -30,7 +30,7 @@ else:
from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner
from django.utils.deprecation import RemovedInDjango60Warning
from django.utils.log import DEFAULT_LOGGING
- from django.utils.version import PY312
+ from django.utils.version import PY312, PYPY
try:
import MySQLdb
@@ -52,7 +52,7 @@ warnings.simplefilter("error", RuntimeWarning)
# references, which are a minority, so the garbage collection threshold can be
# larger than the default threshold of 700 allocations + deallocations without
# much increase in memory usage.
-if not hasattr(sys, "pypy_version_info"):
+if not PYPY:
gc.set_threshold(100_000)
RUNTESTS_DIR = os.path.abspath(os.path.dirname(__file__))