Esempio n. 1
0
        def run(self):
            print('waiting for second process')
            self.sock, addr = self.__server_socket.accept()
            print('accepted second process')

            from tests_python.debugger_unittest import ReaderThread
            self.reader_thread = ReaderThread(self.sock)
            self.reader_thread.start()

            self._sequence = -1
            # initial command is always the version
            self.write_version()
            self.log.append('start_socket')
            self.write_make_initial_run()
            time.sleep(1)

            seq = self.write_list_threads()
            msg = self.wait_for_list_threads(seq)
            assert msg.thread['name'] == 'MainThread'
            assert msg.thread['id'] == 'console_main'

            self.write_get_frame('console_main', '1')
            self.wait_for_vars([
                [
                    '<var name="a" type="int" qualifier="%s" value="int: 10"' %
                    (builtin_qualifier, ),
                    '<var name="a" type="int"  value="int',  # jython
                ],
            ])

            self.finished_ok = True
Esempio n. 2
0
def test_fixture_reader_thread1(_dummy_socket):
    sock = _dummy_socket

    reader_thread = ReaderThread(sock)
    reader_thread.start()

    json_part = json.dumps({'key': 'val'})
    json_part = json_part.replace(':', ':\n')
    msg = json_part

    msg = ('Content-Length: %s\r\n\r\n%s' % (len(msg), msg)).encode('utf-8')
    # Check that receiving 2 messages at a time we're able to properly deal
    # with each one.
    sock.put(msg + msg)

    assert reader_thread.get_next_message('check 1') == json_part
    assert reader_thread.get_next_message('check 2') == json_part
Esempio n. 3
0
def test_fixture_reader_thread3(_dummy_socket):
    sock = _DummySocket()

    reader_thread = ReaderThread(sock)
    reader_thread.start()

    msg = 'aaaaaaabbbbbbbccccccc'
    http = ('Content-Length: %s\r\n\r\n%s' % (len(msg), msg))
    http *= 2
    initial = http
    for i in range(1, len(http)):
        while http:
            sock.put(http[:i])
            http = http[i:]

        assert reader_thread.get_next_message('check 1: %s' % i) == msg
        assert reader_thread.get_next_message('check 2: %s' % i) == msg
        http = initial
Esempio n. 4
0
def test_fixture_reader_thread2(_dummy_socket):
    sock = _DummySocket()

    reader_thread = ReaderThread(sock)
    reader_thread.start()

    json_part = json.dumps({'key': 'val'})
    json_part = json_part.replace(':', ':\n')
    msg = json_part

    http = ('Content-Length: %s\r\n\r\n%s' % (len(msg), msg))
    sock.put('msg1\nmsg2\nmsg3\n' + http + http)

    assert reader_thread.get_next_message('check 1') == 'msg1'
    assert reader_thread.get_next_message('check 2') == 'msg2'
    assert reader_thread.get_next_message('check 3') == 'msg3'
    assert reader_thread.get_next_message('check 4') == json_part
    assert reader_thread.get_next_message('check 5') == json_part