docstr: %%px --stream
code: def test_cellpx_stream(self):
      """%%px --stream"""
      self.minimum_engines(6)
      ip = get_ipython()
      v = self.client[:]
      v.block = True
      v.activate()
  
      v["generate_output"] = generate_output
  
      with capture_output(display=False) as io:
          ip.run_cell_magic("px", "--stream", "generate_output()")
  
      print(io.stdout)
      print(io.stderr, file=sys.stderr)
      assert "\n\n" not in io.stdout
      print(io.stdout)
      lines = io.stdout.splitlines()
      expected = []
      expected.extend(
          [
              r"\[stdout:\d+\]",
              "stdout",
              r"\[stdout:\d+\]",
              "stdout2",
              r"\[output:\d+\]",
              r"IPython\.core\.display\.HTML",
              r"\[output:\d+\]",
              r"IPython\.core\.display\.Math",
              r"Out\[\d+:\d+\]:.*IPython\.core\.display\.Math",
          ]
          * len(v)
      )
  
      # Check that all expected lines are in the output
      self._check_expected_lines_unordered(expected, lines)
  
      assert (
          len(expected) - len(v) <= len(lines) <= len(expected)
      ), f"expected {len(expected)} lines, got: {io.stdout}"
  
      # Do the same for stderr
      print(io.stderr, file=sys.stderr)
      assert "\n\n" not in io.stderr
      lines = io.stderr.splitlines()
      expected = []
      expected.extend(
          [
              r"\[stderr:\d+\]",
              "stderr",
              r"\[stderr:\d+\]",
              "stderr2",
          ]
          * len(v)
      )
      self._check_expected_lines_unordered(expected, lines)
      assert (
          len(expected) - len(v) <= len(lines) <= len(expected)
      ), f"expected {len(expected)} lines, got: {io.stderr}"
  
imports: import re
  import signal
  import sys
  import time
  import pytest
  from IPython import get_ipython
  from IPython.utils.io import capture_output
  import ipyparallel
  from ipyparallel import AsyncResult
  from .clienttest import ClusterTestCase, generate_output, raises_remote
label_desc: Use image node_id 12 for calling the TestParallelMagics obj's underlying member method code with example usage: obj.test_cellpx_stream() without return types