Skip to content

Commit

Permalink
Move Cinder test support library from 3.10.cinder into CinderX
Browse files Browse the repository at this point in the history
Summary: This is needed by tests which will now run in 3.12 too.

Reviewed By: SonicField

Differential Revision: D61735436

fbshipit-source-id: e9f1f5b59eef73d6b5e7f6baeaaad20435d6b358
  • Loading branch information
jbower-fb authored and facebook-github-bot committed Sep 11, 2024
1 parent 99d94e3 commit bc0d99f
Showing 8 changed files with 17 additions and 170 deletions.
147 changes: 0 additions & 147 deletions Lib/test/cinder_support.py

This file was deleted.

3 changes: 2 additions & 1 deletion Lib/test/libregrtest/refleak.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
import sys
import warnings
from inspect import isabstract
from test import cinder_support, support
import cinderx.test_support as cinder_support
from test import support
from test.support import os_helper
from test.libregrtest.utils import clear_caches
from types import CodeType, FunctionType, ModuleType
14 changes: 2 additions & 12 deletions Lib/test/libregrtest/runtest_mp.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@
from test.libregrtest.setup import setup_tests
from test.libregrtest.utils import format_duration, print_warning

from cinderx.test_support import get_cinderjit_xargs


# Display the running tests if nothing happened last N seconds
PROGRESS_UPDATE = 30.0 # seconds
@@ -38,18 +40,6 @@
USE_PROCESS_GROUP = (hasattr(os, "setsid") and hasattr(os, "killpg"))


def get_cinderjit_xargs():
args = []
for k, v in sys._xoptions.items():
if not k.startswith("jit"):
continue
elif v is True:
args.extend(["-X", k])
else:
args.extend(["-X", f"{k}={v}"])
return args


def must_stop(result: TestResult, ns: Namespace) -> bool:
if isinstance(result, Interrupted):
return True
2 changes: 1 addition & 1 deletion Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import unittest
import warnings

from test import cinder_support
import cinderx.test_support as cinder_support
from .testresult import get_test_runner


4 changes: 2 additions & 2 deletions Lib/test/test_asyncio/test_asynclazyvalue.py
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@
from _asyncio import AsyncLazyValue
from functools import wraps
from time import time
from test import cinder_support
import cinderx.test_support as cinder_support


if cinder_support.hasCinderX():
from test.cinder_support import get_await_stack
from cinderx.test_support import get_await_stack


def async_test(f):
4 changes: 2 additions & 2 deletions Lib/test/test_asyncio/test_awaitingfuture.py
Original file line number Diff line number Diff line change
@@ -4,11 +4,11 @@
from _asyncio import _AwaitingFuture
from functools import wraps
import unittest
from test import cinder_support
import cinderx.test_support as cinder_support
from test.test_asyncio import utils as test_utils

if cinder_support.hasCinderX():
from test.cinder_support import get_await_stack
from cinderx.test_support import get_await_stack


def tearDownModule():
3 changes: 2 additions & 1 deletion Lib/test/test_asyncio/test_tasks.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,8 @@
from asyncio import futures
from asyncio import tasks
from test.test_asyncio import utils as test_utils
from test import cinder_support, support
import cinderx.test_support as cinder_support
from test import support
from test.support.script_helper import assert_python_ok
from _testcapi import (
AcquireContextPtr,
10 changes: 6 additions & 4 deletions Lib/test/test_cinder.py
Original file line number Diff line number Diff line change
@@ -35,8 +35,10 @@

import _testcindercapi

from test import cinder_support, libregrtest
from test.cinder_support import CINDERJIT_ENABLED, get_await_stack, verify_stack
import cinderx.test_support as cinder_support
from cinderx.test_support import CINDERJIT_ENABLED, get_await_stack, verify_stack

from test import libregrtest
from test.support.script_helper import assert_python_ok, make_script

from test.test_asyncio.test_futures import CFutureTests
@@ -2132,7 +2134,7 @@ def test_get_stack_with_lineno_3(self):
code = """
from cinder import _get_entire_call_stack_as_qualnames_with_lineno_and_frame
from cinderjit import jit_suppress
from test import cinder_support
import cinderx.test_support as cinder_support
import asyncio
@@ -2169,7 +2171,7 @@ def test_get_stack_with_lineno_4(self):
code = """
from cinder import _get_entire_call_stack_as_qualnames_with_lineno_and_frame
from cinderjit import jit_suppress
from test import cinder_support
import cinderx.test_support as cinder_support
import asyncio

0 comments on commit bc0d99f

Please sign in to comment.