/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/tests/test_load_test.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Jelmer Vernooij
  • Date: 2023-02-02 10:58:19 UTC
  • mfrom: (545.1.1 lp:loggerhead)
  • Revision ID: otto-copilot@canonical.com-20230202105819-0ovmyrv0201wm44u
Improve unittest calls

Merged from https://code.launchpad.net/~jelmer/loggerhead/teyit/+merge/436709

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
"""Tests for the load testing code."""
14
14
 
15
15
import socket
 
16
import threading
16
17
import time
17
 
import threading
18
 
import Queue
 
18
from queue import Empty
19
19
 
20
20
from breezy import tests
21
21
from breezy.tests import http_server
22
22
 
23
 
from loggerhead import load_test
24
 
 
 
23
from .. import load_test
25
24
 
26
25
empty_script = """{
27
26
    "parameters": {},
90
89
    def test_step_next_will_timeout(self):
91
90
        # We don't want step_next to block forever
92
91
        rt = NoopRequestWorker('id', blocking_time=0.001)
93
 
        self.assertRaises(Queue.Empty, rt.step_next)
 
92
        self.assertRaises(Empty, rt.step_next)
94
93
 
95
94
    def test_run_stops_for_stop_event(self):
96
95
        rt = NoopRequestWorker('id', blocking_time=0.001, _queue_size=2)
217
216
        # If an id is found, then we should create it
218
217
        self.assertEqual({}, script._threads)
219
218
        worker = script._get_worker('id')
220
 
        self.assertTrue('id' in script._threads)
 
219
        self.assertIn('id', script._threads)
221
220
        # We should have set the blocking timeout
222
221
        self.assertEqual(script.blocking_timeout / 10.0,
223
222
                         worker.blocking_time)