This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch aevri/enable_spawn_ci_6 in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 44db0a07b2797c79bb28dfe2c3152dc89746ebd3 Author: Angelos Evripiotis <[email protected]> AuthorDate: Fri Oct 25 17:45:07 2019 +0100 tests/sources: server.start() before using port Re-order the calls of `server.start()` and `generate_project_file_server()` such that we are not relying on knowing the server's port before we've called 'start' on it. This allows us to use spawning or forking to start the server process, as we won't be relying on being able to share un-picklable things between the processes. --- tests/sources/remote.py | 2 +- tests/sources/tar.py | 9 +++++---- tests/sources/zip.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/sources/remote.py b/tests/sources/remote.py index 5b818b9..9ffa72d 100644 --- a/tests/sources/remote.py +++ b/tests/sources/remote.py @@ -204,10 +204,10 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): with create_file_server(server_type) as server: server.add_user('testuser', '12345', project) - generate_project_file_server(server, project) server.start() + generate_project_file_server(server, project) result = cli.run(project=project, args=['source', 'fetch', 'target.bst']) result.assert_success() result = cli.run(project=project, args=['build', 'target.bst']) diff --git a/tests/sources/tar.py b/tests/sources/tar.py index fac6f3f..994d568 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -56,6 +56,7 @@ def generate_project(project_dir, tmpdir): def generate_project_file_server(base_url, project_dir): + project_file = os.path.join(project_dir, "project.conf") _yaml.roundtrip_dump({ 'name': 'foo', @@ -358,13 +359,13 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): with create_file_server(server_type) as server: server.add_user('testuser', '12345', file_server_files) + server.start() + generate_project_file_server(server.base_url(), project) src_tar = os.path.join(file_server_files, 'a.tar.gz') _assemble_tar(os.path.join(str(datafiles), 'content'), 'a', src_tar) - server.start() - result = cli.run(project=project, args=['source', 'track', 'target.bst']) result.assert_success() result = cli.run(project=project, args=['source', 'fetch', 'target.bst']) @@ -398,6 +399,8 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir): with create_file_server(server_type) as server: server.add_user('otheruser', '12345', file_server_files) + server.start() + parts = urllib.parse.urlsplit(server.base_url()) base_url = urllib.parse.urlunsplit([parts[0], 'otheruser@{}'.format(parts[1]), *parts[2:]]) generate_project_file_server(base_url, project) @@ -405,8 +408,6 @@ def test_netrc_already_specified_user(cli, datafiles, server_type, tmpdir): src_tar = os.path.join(file_server_files, 'a.tar.gz') _assemble_tar(os.path.join(str(datafiles), 'content'), 'a', src_tar) - server.start() - result = cli.run(project=project, args=['source', 'track', 'target.bst']) result.assert_main_error(ErrorDomain.STREAM, None) result.assert_task_error(ErrorDomain.SOURCE, None) diff --git a/tests/sources/zip.py b/tests/sources/zip.py index 3fd43b4..b298b15 100644 --- a/tests/sources/zip.py +++ b/tests/sources/zip.py @@ -212,13 +212,13 @@ def test_use_netrc(cli, datafiles, server_type, tmpdir): with create_file_server(server_type) as server: server.add_user('testuser', '12345', file_server_files) + server.start() + generate_project_file_server(server, project) src_zip = os.path.join(file_server_files, 'a.zip') _assemble_zip(os.path.join(str(datafiles), 'content'), src_zip) - server.start() - result = cli.run(project=project, args=['source', 'track', 'target.bst']) result.assert_success() result = cli.run(project=project, args=['source', 'fetch', 'target.bst'])
