Commit c77299ed by Aviram Hassan Committed by GitHub

executor: default to parallel operations

This change ensures that non fancy io can use parallel installs.
parent cae154c2
...@@ -29,7 +29,7 @@ from .operations.update import Update ...@@ -29,7 +29,7 @@ from .operations.update import Update
class Executor(object): 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._env = env
self._io = io self._io = io
self._dry_run = False self._dry_run = False
...@@ -39,9 +39,6 @@ class Executor(object): ...@@ -39,9 +39,6 @@ class Executor(object):
self._chef = Chef(config, self._env) self._chef = Chef(config, self._env)
self._chooser = Chooser(pool, self._env) self._chooser = Chooser(pool, self._env)
if parallel is None:
parallel = self.supports_fancy_output()
if parallel: if parallel:
# This should be directly handled by ThreadPoolExecutor # This should be directly handled by ThreadPoolExecutor
# however, on some systems the number of CPUs cannot be determined # however, on some systems the number of CPUs cannot be determined
......
...@@ -253,7 +253,7 @@ Package operations: 4 installs, 0 updates, 0 removals ...@@ -253,7 +253,7 @@ Package operations: 4 installs, 0 updates, 0 removals
• Installing demo (0.1.2 9cf87a2) • 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 assert 4 == tester._command.installer.executor.installations_count
content = app.poetry.file.read()["tool"]["poetry"] content = app.poetry.file.read()["tool"]["poetry"]
...@@ -512,8 +512,10 @@ Package operations: 4 installs, 0 updates, 0 removals ...@@ -512,8 +512,10 @@ Package operations: 4 installs, 0 updates, 0 removals
• Installing tomlkit (0.5.5) • Installing tomlkit (0.5.5)
• Installing demo (0.1.0 https://python-poetry.org/distributions/demo-0.1.0-py2.py3-none-any.whl) • 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.
assert expected == 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 assert 4 == tester._command.installer.executor.installations_count
content = app.poetry.file.read()["tool"]["poetry"] content = app.poetry.file.read()["tool"]["poetry"]
......
...@@ -110,7 +110,10 @@ Package operations: 4 installs, 1 update, 1 removal ...@@ -110,7 +110,10 @@ Package operations: 4 installs, 1 update, 1 removal
""".format( """.format(
file_package.source_url, directory_package.source_url 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) assert 5 == len(env.executed)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment