Repository: python-poetry/poetry

Issue:
Poetry install -q (and update -q) produce messages
<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [ ] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: Xubuntu 20.04
- **Poetry version**: 1.1.2
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/berislavlopac/949972163f24f734ea84c27fbb27b2f4

## Issue
Running `poetry update -q` and `poetry install -q` produces output, although somewhat more limited than normally.

```
~/D/test ❯❯❯ (test) poetry install
Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

Package operations: 6 installs, 0 updates, 0 removals

  • Installing certifi (2020.6.20)
  • Installing chardet (3.0.4)
  • Installing idna (2.10)
  • Installing urllib3 (1.25.10)
  • Installing requests (2.24.0)
  • Installing starlette (0.13.8)
```

```
~/D/test ❯❯❯ (test) poetry install -q
  • Installing certifi (2020.6.20)
  • Installing chardet (3.0.4)
  • Installing idna (2.10)
  • Installing urllib3 (1.25.10)
  • Installing requests (2.24.0)
  • Installing starlette (0.13.8)
```

Using multiple `q`s (`poetry install -qq`) has the same result as none at all.

I was expecting no messages at all, as was the case in earlier versions.


Discussion:

Resolving patch:
diff --git a/poetry/installation/executor.py b/poetry/installation/executor.py
--- a/poetry/installation/executor.py
+++ b/poetry/installation/executor.py
@@ -700,7 +700,4 @@ def _download_archive(self, operation: Union[Install, Update], link: Link) -> Pa
         return archive
 
     def _should_write_operation(self, operation: Operation) -> bool:
-        if not operation.skipped:
-            return True
-
-        return self._dry_run or self._verbose
+        return not operation.skipped or self._dry_run or self._verbose


Test patch:
diff --git a/tests/installation/test_installer.py b/tests/installation/test_installer.py
--- a/tests/installation/test_installer.py
+++ b/tests/installation/test_installer.py
@@ -7,7 +7,11 @@
 
 import pytest
 
+from cleo.io.inputs.input import Input
+from cleo.io.io import IO
 from cleo.io.null_io import NullIO
+from cleo.io.outputs.buffered_output import BufferedOutput
+from cleo.io.outputs.output import Verbosity
 
 from poetry.core.packages import ProjectPackage
 from poetry.core.toml.file import TOMLFile
@@ -1889,3 +1893,28 @@ def test_installer_can_handle_old_lock_files(
 
     # colorama will be added
     assert 8 == installer.executor.installations_count
+
+
+@pytest.mark.parametrize("quiet", [True, False])
+def test_run_with_dependencies_quiet(installer, locker, repo, package, quiet):
+    package_a = get_package("A", "1.0")
+    package_b = get_package("B", "1.1")
+    repo.add_package(package_a)
+    repo.add_package(package_b)
+
+    installer._io = IO(Input(), BufferedOutput(), BufferedOutput())
+    installer._io.set_verbosity(Verbosity.QUIET if quiet else Verbosity.NORMAL)
+
+    package.add_dependency(Factory.create_dependency("A", "~1.0"))
+    package.add_dependency(Factory.create_dependency("B", "^1.0"))
+
+    installer.run()
+    expected = fixture("with-dependencies")
+
+    assert locker.written_data == expected
+
+    installer._io.output._buffer.seek(0)
+    if quiet:
+        assert installer._io.output._buffer.read() == ""
+    else:
+        assert installer._io.output._buffer.read() != ""