# HG changeset patch # User RhodeCode Admin # Date 2023-08-29 14:52:31 # Node ID 7fe32e441e562b548485b0cc0ccd176b10b2c39a # Parent 039ef6ecc485fb3f272272317bb15f3d865d7f85 tests: fixed stream test chunking that returned wrongly str not bytes diff --git a/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py b/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py --- a/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py +++ b/rhodecode/tests/lib/middleware/utils/test_scm_app_http_chunking.py @@ -40,6 +40,9 @@ def test_does_chunked_end_to_end_transfe assert times[1] - times[0] > 0.1, "Chunks arrived at the same time" +SCM_APP_URL_TMPL = 'http://0.0.0.0:{port}' + + @pytest.fixture() def echo_app_chunking(request, available_port_factory): """ @@ -54,7 +57,7 @@ def echo_app_chunking(request, available ':create_echo_app') command = command.format(port=port) proc = subprocess.Popen(command.split(' '), bufsize=0) - echo_app_url = 'http://localhost:' + str(port) + echo_app_url = SCM_APP_URL_TMPL.format(port=port) @request.addfinalizer def stop_echo_app(): @@ -79,7 +82,7 @@ def scm_app(request, available_port_fact env = os.environ.copy() env["RC_ECHO_URL"] = echo_app_chunking proc = subprocess.Popen(command.split(' '), bufsize=0, env=env) - scm_app_url = 'http://localhost:' + str(port) + scm_app_url = SCM_APP_URL_TMPL.format(port=port) wait_for_url(scm_app_url) @request.addfinalizer @@ -112,10 +115,10 @@ def result_generator(): The intended usage is to simulate a chunked response as we would get it out of a vcs operation during a call to "hg clone". """ - yield 'waiting 2 seconds' + yield b'waiting 2 seconds' # Wait long enough so that the first chunk can go out time.sleep(2) - yield 'final chunk' + yield b'final chunk' # Another small wait, otherwise they go together time.sleep(0.1)