[CI][RFC] Replace black-jupyter with ruff-format (#37210)
Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
co-authored by
Alison Shao
parent
2641e427be
commit
28262c20df
@@ -15,7 +15,6 @@ register_cpu_ci(est_time=8, suite="base-a-test-cpu")
|
||||
|
||||
|
||||
class _FakeResponse:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.read_called = False
|
||||
|
||||
@@ -25,7 +24,6 @@ class _FakeResponse:
|
||||
|
||||
|
||||
class _FakePostCM:
|
||||
|
||||
def __init__(self, response: _FakeResponse) -> None:
|
||||
self._response = response
|
||||
|
||||
@@ -37,7 +35,6 @@ class _FakePostCM:
|
||||
|
||||
|
||||
class _FakeSession:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.closed = False
|
||||
self.calls: list[tuple[str, object]] = []
|
||||
@@ -52,7 +49,6 @@ class _FakeSession:
|
||||
|
||||
|
||||
class TestBackgroundHttpPosterLifecycle(CustomTestCase):
|
||||
|
||||
def test_init_starts_running_loop_on_daemon_thread(self):
|
||||
poster = BackgroundHttpPoster()
|
||||
self.addCleanup(poster.close)
|
||||
@@ -80,7 +76,6 @@ class TestBackgroundHttpPosterLifecycle(CustomTestCase):
|
||||
|
||||
|
||||
class TestBackgroundHttpPosterSubmitCoro(CustomTestCase):
|
||||
|
||||
def test_submit_coro_runs_on_background_loop_thread(self):
|
||||
poster = BackgroundHttpPoster()
|
||||
self.addCleanup(poster.close)
|
||||
@@ -134,7 +129,6 @@ class TestBackgroundHttpPosterSubmitCoro(CustomTestCase):
|
||||
|
||||
|
||||
class TestBackgroundHttpPosterEnsureSession(CustomTestCase):
|
||||
|
||||
def test_ensure_session_creates_reuses_then_recreates_when_closed(self):
|
||||
poster = BackgroundHttpPoster()
|
||||
self.addCleanup(poster.close)
|
||||
@@ -160,7 +154,6 @@ class TestBackgroundHttpPosterEnsureSession(CustomTestCase):
|
||||
|
||||
|
||||
class TestBackgroundHttpPosterPost(CustomTestCase):
|
||||
|
||||
def _run_on_loop(self, poster: BackgroundHttpPoster, coro) -> None:
|
||||
asyncio.run_coroutine_threadsafe(coro, poster._loop).result(timeout=5.0)
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ _NO_REPLY = object()
|
||||
|
||||
|
||||
class _PairSocketHarness:
|
||||
|
||||
def __init__(self, *, reply: object = _NO_REPLY) -> None:
|
||||
self._ctx = zmq.Context()
|
||||
self.server_socket = self._ctx.socket(zmq.PAIR)
|
||||
@@ -62,7 +61,6 @@ class _PairSocketHarness:
|
||||
|
||||
|
||||
class _FakeProcess:
|
||||
|
||||
def __init__(self, *, alive: bool) -> None:
|
||||
self._alive = alive
|
||||
|
||||
@@ -79,7 +77,6 @@ def _make_server(socket: zmq.Socket, process: _FakeProcess) -> ScriptedHttpServe
|
||||
|
||||
|
||||
class TestExecuteScriptReplyMatching(CustomTestCase):
|
||||
|
||||
def test_returns_on_script_succeeded(self):
|
||||
with _PairSocketHarness(reply=ScriptSucceeded()) as pair:
|
||||
server = _make_server(pair.server_socket, _FakeProcess(alive=True))
|
||||
@@ -116,7 +113,6 @@ class TestExecuteScriptReplyMatching(CustomTestCase):
|
||||
|
||||
|
||||
class TestExecuteScriptNoReply(CustomTestCase):
|
||||
|
||||
def test_timeout_when_process_still_alive(self):
|
||||
with _PairSocketHarness() as pair:
|
||||
server = _make_server(pair.server_socket, _FakeProcess(alive=True))
|
||||
@@ -135,7 +131,6 @@ class TestExecuteScriptNoReply(CustomTestCase):
|
||||
|
||||
|
||||
class TestExecuteScriptDirtyGuard(CustomTestCase):
|
||||
|
||||
def test_refuses_to_run_when_already_dirty(self):
|
||||
with _PairSocketHarness() as pair:
|
||||
server = _make_server(pair.server_socket, _FakeProcess(alive=True))
|
||||
|
||||
@@ -26,7 +26,6 @@ def _raising_gen():
|
||||
|
||||
|
||||
class TestAdvanceGenerator(CustomTestCase):
|
||||
|
||||
def test_not_done_when_generator_yields(self):
|
||||
done, exc_tb = scheduler_hook._advance_generator(_yielding_gen())
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ register_cpu_ci(est_time=2, suite="base-a-test-cpu")
|
||||
|
||||
|
||||
class TestResolveFn(CustomTestCase):
|
||||
|
||||
def test_resolves_top_level_function(self):
|
||||
self.assertIs(resolve_fn("json:dumps"), json.dumps)
|
||||
|
||||
@@ -46,7 +45,6 @@ class TestResolveFn(CustomTestCase):
|
||||
|
||||
|
||||
class TestEnsureScriptImportable(CustomTestCase):
|
||||
|
||||
_FAKE_ENTRY = "/tmp/__scripted_runtime_ut_fake_sys_path__"
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -18,18 +18,15 @@ import unittest
|
||||
|
||||
@dataclass
|
||||
class _ControlMsg:
|
||||
|
||||
tag: str = "flush"
|
||||
|
||||
|
||||
@dataclass
|
||||
class _StartReq:
|
||||
|
||||
rid: str
|
||||
|
||||
|
||||
class _FakeUnderlyingSocket:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._ready: deque = deque()
|
||||
self._scheduled: list[list] = []
|
||||
@@ -62,7 +59,6 @@ def _is_start_req(rid: str):
|
||||
|
||||
|
||||
class TestScriptedTokenizerRecvProxyRecv(CustomTestCase):
|
||||
|
||||
def test_recv_pyobj_drains_then_pops_fifo(self):
|
||||
underlying = _FakeUnderlyingSocket()
|
||||
proxy = ScriptedTokenizerRecvProxy(underlying=underlying)
|
||||
@@ -88,7 +84,6 @@ class TestScriptedTokenizerRecvProxyRecv(CustomTestCase):
|
||||
|
||||
|
||||
class TestScriptedTokenizerRecvProxyWaitUntilArrived(CustomTestCase):
|
||||
|
||||
def _proxy_with_stale_control(self):
|
||||
underlying = _FakeUnderlyingSocket()
|
||||
proxy = ScriptedTokenizerRecvProxy(underlying=underlying)
|
||||
|
||||
Reference in New Issue
Block a user