Repository: python-poetry/poetry

Issue:
unexpected empty environments listing
<!--
  Hi there! Thank you for discovering and submitting an issue.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- 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).

<!--
  Once those are done, if you're able to fill in the following list with your information,
  it'd be very helpful to whoever handles the issue.
-->

- **OS version and name**: macos 10.15.2
- **Poetry version**: 1.0.0

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->

Surprisingly `poetry env list` does not return anything. Virtualenv was created by `poetry install` in a local directory using local `poetry.toml` 

```
[virtualenvs]
in-project = true
```

Output:
```
 ~/Projects/fooproject ❯ poetry env use 3.7.4                                                                                                                                                     3.7.4
Using virtualenv: /Users/Silver/Projects/fooproject/.venv
 ~/Projects/fooproject  ❯ poetry env list                                                                                                                                                          3.7.4
 ~/Projects/fooproject  ❯ poetry env list --full-path                                                                                                                                              3.7.4
 ~/Projects/fooproject  ❯ poetry env info                                                                                                                                                          3.7.4

Virtualenv
Python:         3.7.4
Implementation: CPython
Path:           /Users/Silver/Projects/fooproject/.venv
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /Users/Silver/.pyenv/versions/3.7.4
 ~/Projects/fooproject ❯ poetry --version                                                                                                                                                         3.7.4
Poetry version 1.0.0
```


Discussion:

Resolving patch:
diff --git a/poetry/utils/env.py b/poetry/utils/env.py
--- a/poetry/utils/env.py
+++ b/poetry/utils/env.py
@@ -367,11 +367,20 @@ def list(self, name=None):  # type: (Optional[str]) -> List[VirtualEnv]
         else:
             venv_path = Path(venv_path)
 
-        return [
+        env_list = [
             VirtualEnv(Path(p))
             for p in sorted(venv_path.glob("{}-py*".format(venv_name)))
         ]
 
+        venv = self._poetry.file.parent / ".venv"
+        if (
+            self._poetry.config.get("virtualenvs.in-project")
+            and venv.exists()
+            and venv.is_dir()
+        ):
+            env_list.insert(0, VirtualEnv(venv))
+        return env_list
+
     def remove(self, python):  # type: (str) -> Env
         venv_path = self._poetry.config.get("virtualenvs.path")
         if venv_path is None:


Test patch:
diff --git a/tests/console/commands/env/test_list.py b/tests/console/commands/env/test_list.py
--- a/tests/console/commands/env/test_list.py
+++ b/tests/console/commands/env/test_list.py
@@ -1,3 +1,5 @@
+import os
+
 import tomlkit
 
 from cleo.testers import CommandTester
@@ -56,3 +58,19 @@ def test_activated(app, tmp_dir):
     )
 
     assert expected == tester.io.fetch_output()
+
+
+def test_in_project_venv(app, tmpdir):
+    os.environ.pop("VIRTUAL_ENV", None)
+    app.poetry.config.merge({"virtualenvs": {"in-project": True}})
+
+    (app.poetry.file.parent / ".venv").mkdir(exist_ok=True)
+
+    command = app.find("env list")
+    tester = CommandTester(command)
+    tester.execute()
+
+    expected = ".venv (Activated)\n"
+
+    assert expected == tester.io.fetch_output()
+    (app.poetry.file.parent / ".venv").rmdir()