##// END OF EJS Templates
tests: fixed stream test chunking that returned wrongly str not bytes
super-admin -
r5168:7fe32e44 default
parent child Browse files
Show More
@@ -40,6 +40,9 b' def test_does_chunked_end_to_end_transfe'
40 assert times[1] - times[0] > 0.1, "Chunks arrived at the same time"
40 assert times[1] - times[0] > 0.1, "Chunks arrived at the same time"
41
41
42
42
43 SCM_APP_URL_TMPL = 'http://0.0.0.0:{port}'
44
45
43 @pytest.fixture()
46 @pytest.fixture()
44 def echo_app_chunking(request, available_port_factory):
47 def echo_app_chunking(request, available_port_factory):
45 """
48 """
@@ -54,7 +57,7 b' def echo_app_chunking(request, available'
54 ':create_echo_app')
57 ':create_echo_app')
55 command = command.format(port=port)
58 command = command.format(port=port)
56 proc = subprocess.Popen(command.split(' '), bufsize=0)
59 proc = subprocess.Popen(command.split(' '), bufsize=0)
57 echo_app_url = 'http://localhost:' + str(port)
60 echo_app_url = SCM_APP_URL_TMPL.format(port=port)
58
61
59 @request.addfinalizer
62 @request.addfinalizer
60 def stop_echo_app():
63 def stop_echo_app():
@@ -79,7 +82,7 b' def scm_app(request, available_port_fact'
79 env = os.environ.copy()
82 env = os.environ.copy()
80 env["RC_ECHO_URL"] = echo_app_chunking
83 env["RC_ECHO_URL"] = echo_app_chunking
81 proc = subprocess.Popen(command.split(' '), bufsize=0, env=env)
84 proc = subprocess.Popen(command.split(' '), bufsize=0, env=env)
82 scm_app_url = 'http://localhost:' + str(port)
85 scm_app_url = SCM_APP_URL_TMPL.format(port=port)
83 wait_for_url(scm_app_url)
86 wait_for_url(scm_app_url)
84
87
85 @request.addfinalizer
88 @request.addfinalizer
@@ -112,10 +115,10 b' def result_generator():'
112 The intended usage is to simulate a chunked response as we would get it
115 The intended usage is to simulate a chunked response as we would get it
113 out of a vcs operation during a call to "hg clone".
116 out of a vcs operation during a call to "hg clone".
114 """
117 """
115 yield 'waiting 2 seconds'
118 yield b'waiting 2 seconds'
116 # Wait long enough so that the first chunk can go out
119 # Wait long enough so that the first chunk can go out
117 time.sleep(2)
120 time.sleep(2)
118 yield 'final chunk'
121 yield b'final chunk'
119 # Another small wait, otherwise they go together
122 # Another small wait, otherwise they go together
120 time.sleep(0.1)
123 time.sleep(0.1)
121
124
General Comments 0
You need to be logged in to leave comments. Login now