Repository: pypa/pipenv

Issue:
pipenv update --outdated --pre wont work if there are prerelease packages
### Issue description

Describe the issue briefly here.
```
pipenv update --outdated --pre

Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Could not find a version that matches black
Tried: 18.3a0, 18.3a0, 18.3a1, 18.3a1, 18.3a2, 18.3a2, 18.3a3, 18.3a3, 18.3a4, 18.3a4, 18.4a0, 18.4a0, 18.4a1, 18.4a1, 18.4a2, 18.4a2, 18.4a3, 18.4a3, 18.4a4, 18.4a4, 18.5b0, 18.5b0, 18.5b1, 18.5b1, 18.6b0, 18.6b0, 18.6b1, 18.6b1, 18.6b2, 18.6b2, 18.6b3, 18.6b3, 18.6b4, 18.6b4, 18.9b0, 18.9b0, 19.3b0, 19.3b0
```




Discussion:

Resolving patch:
diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py
--- a/pipenv/cli/command.py
+++ b/pipenv/cli/command.py
@@ -484,7 +484,7 @@ def update(
     if not outdated:
         outdated = bool(dry_run)
     if outdated:
-        do_outdated(pypi_mirror=state.pypi_mirror)
+        do_outdated(clear=state.clear, pre=state.installstate.pre, pypi_mirror=state.pypi_mirror)
     packages = [p for p in state.installstate.packages if p]
     editable = [p for p in state.installstate.editables if p]
     if not packages:
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -1767,7 +1767,7 @@ def do_py(system=False):
         click.echo(crayons.red("No project found!"))
 
 
-def do_outdated(pypi_mirror=None):
+def do_outdated(pypi_mirror=None, pre=False, clear=False):
     # TODO: Allow --skip-lock here?
     from .vendor.requirementslib.models.requirements import Requirement
     from .vendor.requirementslib.models.utils import get_version
@@ -1789,7 +1789,7 @@ def do_outdated(pypi_mirror=None):
         dep = Requirement.from_line(str(result.as_requirement()))
         packages.update(dep.as_pipfile())
     updated_packages = {}
-    lockfile = do_lock(write=False, pypi_mirror=pypi_mirror)
+    lockfile = do_lock(clear=clear, pre=pre, write=False, pypi_mirror=pypi_mirror)
     for section in ("develop", "default"):
         for package in lockfile[section]:
             try:


Test patch:
diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py
--- a/tests/integration/test_cli.py
+++ b/tests/integration/test_cli.py
@@ -265,3 +265,16 @@ def test_pipenv_three(PipenvInstance):
         c = p.pipenv('--three')
         assert c.return_code == 0
         assert 'Successfully created virtual environment' in c.err
+
+
+@pytest.mark.outdated
+def test_pipenv_outdated_prerelease(PipenvInstance):
+    with PipenvInstance(chdir=True) as p:
+        with open(p.pipfile_path, "w") as f:
+            contents = """
+[packages]
+sqlalchemy = "<=1.2.3"
+            """.strip()
+            f.write(contents)
+        c = p.pipenv('update --pre --outdated')
+        assert c.return_code == 0
diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py
--- a/tests/integration/test_install_basic.py
+++ b/tests/integration/test_install_basic.py
@@ -7,7 +7,6 @@
 from flaky import flaky
 
 from pipenv._compat import Path, TemporaryDirectory
-from pipenv.project import Project
 from pipenv.utils import temp_environ
 from pipenv.vendor import delegator