コード例 #1
0
    def test_multiple_servers(self):
        """Test multiple concurrent servers."""
        pid2 = buffer_server.start(self.channels, self._next_buf_name())

        n_records = 200
        for count, data in enumerate(mock_data(n_records, self.channel_count)):
            if count % 2 == 0:
                buffer_server.append(self.pid, Record(data, count, None))
            else:
                buffer_server.append(pid2, Record(data, count, None))

        self.assertEqual(buffer_server.count(self.pid), n_records / 2)
        self.assertEqual(buffer_server.count(pid2), n_records / 2)

        server1_data = buffer_server.get_data(self.pid, 0, 5)
        server2_data = buffer_server.get_data(pid2, 0, 5)

        self.assertNotEqual(server1_data, server2_data)
        buffer_server.stop(pid2)
コード例 #2
0
ファイル: test_buffer_server.py プロジェクト: shiva16/BciPy
    def test_multiple_servers(self):
        pid2 = buffer_server.start(self.channels, self._next_buf_name())

        n = 200
        for i in range(n):
            d = [
                np.random.uniform(-1000, 1000)
                for cc in range(self.channel_count)
            ]
            if i % 2 == 0:
                buffer_server.append(self.pid, Record(d, i, None))
            else:
                buffer_server.append(pid2, Record(d, i, None))

        self.assertEqual(buffer_server.count(self.pid), n / 2)
        self.assertEqual(buffer_server.count(pid2), n / 2)

        server1_data = buffer_server.get_data(self.pid, 0, 5)
        server2_data = buffer_server.get_data(pid2, 0, 5)

        self.assertNotEqual(server1_data, server2_data)
        buffer_server.stop(pid2)
コード例 #3
0
 def cleanup(self):
     """Performs cleanup tasks, such as deleting the buffer archive. Note
     that data will be unavailable after calling this method."""
     if self._buf:
         buffer_server.stop(self._buf, delete_archive=self.delete_archive)
         self._buf = None
コード例 #4
0
ファイル: test_buffer_server.py プロジェクト: shiva16/BciPy
 def tearDown(self):
     """Run after each test."""
     buffer_server.stop(self.pid)
     self.pid = None