From 4a33933e308dcf4cd4b8ba8906fc1720e419191a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 14 Nov 2022 23:11:57 -0300 Subject: [PATCH] Use ternary operator to remove mypy error Otherwise we would get this error: ``` error: Function "Callable[[Any, bool, Optional[float]], None]" could always be true in boolean context [truthy-function] ``` --- testing/test_remote.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index ddfed9e..8742ee5 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -29,11 +29,10 @@ class EventCall: class WorkerSetup: - use_callback = False - def __init__(self, request, pytester: pytest.Pytester) -> None: self.request = request self.pytester = pytester + self.use_callback = False self.events = Queue() # type: ignore[var-annotated] def setup(self) -> None: @@ -41,7 +40,7 @@ class WorkerSetup: # import os ; os.environ['EXECNET_DEBUG'] = "2" self.gateway = execnet.makegateway() self.config = config = self.pytester.parseconfigure() - putevent = self.use_callback and self.events.put or None + putevent = self.events.put if self.use_callback else None class DummyMananger: testrunuid = uuid.uuid4().hex