Repository: theacodes/nox (python)
Issue: conda bin_paths are missing `Library\...` subdirectories on windows
<!-- Thank you for filing a bug! Please feel free to answer as much or as little of this template as you can. -->

**Describe the bug**

When running python code that requires external executables from `conda` packages - i.e. `ipopt`, they cannot be found on the PATH.

**How to reproduce**

This noxfile fails - it should find 'ipopt.exe' on the PATH:
```python
import nox

@nox.session(python="3.7", venv_backend="conda")
def conda_path_bug(session):
    session.conda_install("conda-forge::ipopt==3.11.1")  
    session.run("python", "-c", "import shutil; assert shutil.which('ipopt')")
```


**Expected behavior**

The PATH should be set to include the same entries as Anaconda's `cwp.py` provides:
```python
new_paths = pathsep.join([prefix,
                         join(prefix, "Library", "mingw-w64", "bin"),
                         join(prefix, "Library", "usr", "bin"),
                         join(prefix, "Library", "bin"),
                         join(prefix, "Scripts")])
env = os.environ.copy()
env['PATH'] = new_paths + pathsep + env['PATH']
env['CONDA_PREFIX'] = prefix
```

Pull request description: Correct bin paths in CondaEnv for Windows
Closes #514.

Patch:
diff --git a/nox/virtualenv.py b/nox/virtualenv.py
index 501118f..4d928ab 100644
--- a/nox/virtualenv.py
+++ b/nox/virtualenv.py
@@ -231,9 +231,16 @@ class CondaEnv(ProcessEnv):
     @property
     def bin_paths(self) -> List[str]:
         """Returns the location of the conda env's bin folder."""
-        # see https://docs.anaconda.com/anaconda/user-guide/tasks/integration/python-path/#examples
+        # see https://github.com/conda/conda/blob/f60f0f1643af04ed9a51da3dd4fa242de81e32f4/conda/activate.py#L563-L572
         if _SYSTEM == "Windows":
-            return [self.location, os.path.join(self.location, "Scripts")]
+            return [
+                self.location,
+                os.path.join(self.location, "Library", "mingw-w64", "bin"),
+                os.path.join(self.location, "Library", "usr", "bin"),
+                os.path.join(self.location, "Library", "bin"),
+                os.path.join(self.location, "Scripts"),
+                os.path.join(self.location, "bin"),
+            ]
         else:
             return [os.path.join(self.location, "bin")]
 


Test patch:
diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py
index c1df711..441eaa8 100644
--- a/tests/test_virtualenv.py
+++ b/tests/test_virtualenv.py
@@ -230,7 +230,14 @@ def test_conda_env_create_verbose(make_conda):
 @mock.patch("nox.virtualenv._SYSTEM", new="Windows")
 def test_condaenv_bin_windows(make_conda):
     venv, dir_ = make_conda()
-    assert [dir_.strpath, dir_.join("Scripts").strpath] == venv.bin_paths
+    assert [
+        dir_.strpath,
+        dir_.join("Library", "mingw-w64", "bin").strpath,
+        dir_.join("Library", "usr", "bin").strpath,
+        dir_.join("Library", "bin").strpath,
+        dir_.join("Scripts").strpath,
+        dir_.join("bin").strpath,
+    ] == venv.bin_paths
 
 
 @pytest.mark.skipif(not HAS_CONDA, reason="Missing conda command.")