From 46ad8bfaf772343c98377fcb56d60be01ba789df Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Mon, 13 Jul 2020 18:19:50 +0300 Subject: [PATCH 1/5] executor: enable parallel even if no fancy output (enable on CI) --- poetry/installation/executor.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/poetry/installation/executor.py b/poetry/installation/executor.py index 6e48278b029..c80955dff6d 100644 --- a/poetry/installation/executor.py +++ b/poetry/installation/executor.py @@ -29,7 +29,7 @@ class Executor(object): - def __init__(self, env, pool, config, io, parallel=None): + def __init__(self, env, pool, config, io, parallel=True): self._env = env self._io = io self._dry_run = False @@ -39,9 +39,6 @@ def __init__(self, env, pool, config, io, parallel=None): self._chef = Chef(config, self._env) self._chooser = Chooser(pool, self._env) - if parallel is None: - parallel = self.supports_fancy_output() - if parallel: # This should be directly handled by ThreadPoolExecutor # however, on some systems the number of CPUs cannot be determined From ccf367d03ac82a4fb11ce34db85665841294e1d7 Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Tue, 14 Jul 2020 17:36:23 +0300 Subject: [PATCH 2/5] test_add.py: changed output test to be more robust --- tests/console/commands/test_add.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index 9572427c81b..9b9bcf60ebb 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -512,8 +512,10 @@ def test_add_url_constraint_wheel_with_extras(app, repo, tester, mocker): • Installing tomlkit (0.5.5) • Installing demo (0.1.0 https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl) """ - - assert expected == tester.io.fetch_output() + # Order might be different, split into lines and compare the overall output. + expected = set(expected.splitlines) + output = set(tester.io.fetch_output()) + assert expected == output assert 4 == tester._command.installer.executor.installations_count content = app.poetry.file.read()["tool"]["poetry"] From e24971679bbbbf78e3e5fbf1bee2ed8f5e1480b6 Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Tue, 14 Jul 2020 17:40:22 +0300 Subject: [PATCH 3/5] fix test_add_url_constraint_wheel_with_extras --- tests/console/commands/test_add.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index 9b9bcf60ebb..2923191dc37 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -513,8 +513,8 @@ def test_add_url_constraint_wheel_with_extras(app, repo, tester, mocker): • Installing demo (0.1.0 https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl) """ # Order might be different, split into lines and compare the overall output. - expected = set(expected.splitlines) - output = set(tester.io.fetch_output()) + expected = set(expected.splitlines()) + output = set(tester.io.fetch_output().splitlines()) assert expected == output assert 4 == tester._command.installer.executor.installations_count From 6149c167f4d8b803691740a496a8e21da6f434ba Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Tue, 14 Jul 2020 17:47:33 +0300 Subject: [PATCH 4/5] fixed test_executor in parallel ci --- tests/installation/test_executor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index 7f9b20a8aa9..505df9e03f3 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -109,7 +109,10 @@ def test_execute_executes_a_batch_of_operations( """.format( file_package.source_url, directory_package.source_url ) - assert expected == io.fetch_output() + + expected = set(expected.splitlines()) + output = set(io.fetch_output().splitlines()) + assert expected == output assert 5 == len(env.executed) From c1db0c7e1706f733a60d8f1656e507514d9eed97 Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Tue, 14 Jul 2020 22:57:24 +0300 Subject: [PATCH 5/5] test_add_git_constraint_with_extras: add strip to output/expected for robustness --- tests/console/commands/test_add.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index 2923191dc37..22466a43057 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -253,7 +253,7 @@ def test_add_git_constraint_with_extras(app, repo, tester, tmp_venv): • Installing demo (0.1.2 9cf87a2) """ - assert expected == tester.io.fetch_output() + assert expected.strip() == tester.io.fetch_output().strip() assert 4 == tester._command.installer.executor.installations_count content = app.poetry.file.read()["tool"]["poetry"]