aaltay commented on a change in pull request #12464:
URL: https://github.com/apache/beam/pull/12464#discussion_r465333885



##########
File path: sdks/python/apache_beam/testing/test_stream_service.py
##########
@@ -50,9 +52,17 @@ def __init__(self, reader, endpoint=None, 
exception_handler=None):
       self._exception_handler = lambda _: False
 
   def start(self):
-    self._server.start()
+    # A server can only be started if never started and never stopped before.
+    if not self._server_started and not self._server_stopped:
+      self._server_started = True
+      self._server.start()
 
   def stop(self):
+    # A server can only be stopped if already started and never stopped before.
+    if not self._server_started or self._server_stopped:

Review comment:
       Write this in a format similar to start():
   
   `if self._server_started and not self._server_stopped:`
   
   or change start to similar format as
   
   ```
   if self._server_started or self._server_stopped:
       return
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to