def test_102(self):
        """
        Two parallel threads with same stdout should interleave
        """
        outs = StringIO()
        self.stash('test_102_1.py &', final_outs=outs)
        self.stash('test_102_2.py &', final_outs=outs)
        time.sleep(5)
        s = outs.getvalue()

        # Count the number of times the output switches between threads
        change_cnt = 0
        prev_line = None
        for cur_line in outs.getvalue().splitlines():
            if prev_line is None:
                prev_line = cur_line
            elif prev_line != cur_line:
                change_cnt += 1
                prev_line = cur_line

        self.assertTrue(change_cnt > 2, 'Output do not interleave')

        Two parallel threads with same stdout should interleave
        
tests/system/test_threads.py