From b74c6586fa5f81324ebb9ab9760a4913275ffbd3 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Fri, 22 Jun 2018 15:36:17 -0400 Subject: [PATCH] Minor control flow and test logic updates Signed-off-by: Dan Ryan --- pipenv/core.py | 32 +++++++++++++---------- tests/integration/test_install_markers.py | 1 - tests/integration/test_sync.py | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index 804f469c52..82d1b34baa 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1930,6 +1930,8 @@ def do_install( # Allow more than one package to be provided. package_names = [package_name] + more_packages # Support for --selective-upgrade. + # We should do this part first to make sure that we actually do selectively upgrade + # the items specified if selective_upgrade: for i, package_name in enumerate(package_names[:]): section = project.packages if not dev else project.dev_packages @@ -1950,6 +1952,8 @@ def do_install( except KeyError: pass # Install all dependencies, if none was provided. + # This basically ensures that we have a pipfile and lockfile, then it locks and + # installs from the lockfile if package_name is False: # Update project settings with pre preference. if pre: @@ -1967,8 +1971,8 @@ def do_install( requirements_dir=requirements_directory, pypi_mirror=pypi_mirror, ) - requirements_directory.cleanup() + # This is for if the user passed in dependencies, then we want to maek sure we else: for package_name in package_names: click.echo( @@ -2057,18 +2061,18 @@ def do_install( # Update project settings with pre preference. if pre: project.update_settings({'allow_prereleases': pre}) - if lock and not skip_lock: - do_init( - dev=dev, - system=system, - allow_global=system, - concurrent=concurrent, - verbose=verbose, - keep_outdated=keep_outdated, - requirements_dir=requirements_directory, - deploy=deploy, - pypi_mirror=pypi_mirror, - ) + do_init( + dev=dev, + system=system, + allow_global=system, + concurrent=concurrent, + verbose=verbose, + keep_outdated=keep_outdated, + requirements_dir=requirements_directory, + deploy=deploy, + pypi_mirror=pypi_mirror, + skip_lock=skip_lock + ) requirements_directory.cleanup() sys.exit(0) @@ -2327,7 +2331,7 @@ def do_run(command, args, three=None, python=False): try: script = project.build_script(command, args) except ScriptEmptyError: - click.echo("Can't run script {0!r}—it's empty?", err=True) + click.echo("Can't run script {0!r}-it's empty?", err=True) if os.name == 'nt': do_run_nt(script) else: diff --git a/tests/integration/test_install_markers.py b/tests/integration/test_install_markers.py index d676e1c0eb..0b88549399 100644 --- a/tests/integration/test_install_markers.py +++ b/tests/integration/test_install_markers.py @@ -127,7 +127,6 @@ def test_global_overrides_environment_markers(PipenvInstance, pypi): @pytest.mark.complex @flaky @py3_only -@pytest.mark.skip(reason='This test is garbage and I hate it') def test_resolver_unique_markers(PipenvInstance, pypi): """vcrpy has a dependency on `yarl` which comes with a marker of 'python version in "3.4, 3.5, 3.6" - this marker duplicates itself: diff --git a/tests/integration/test_sync.py b/tests/integration/test_sync.py index 389551924b..401eadfe04 100644 --- a/tests/integration/test_sync.py +++ b/tests/integration/test_sync.py @@ -22,7 +22,7 @@ def test_sync_error_without_lockfile(PipenvInstance, pypi): @pytest.mark.lock def test_mirror_lock_sync(PipenvInstance, pypi): with temp_environ(), PipenvInstance(chdir=True) as p: - mirror_url = os.environ.pop('PIPENV_TEST_INDEX', "https://pypi.kennethreitz..org/simple") + mirror_url = os.environ.pop('PIPENV_TEST_INDEX', "https://pypi.kennethreitz.org/simple") assert 'pypi.org' not in mirror_url with open(p.pipfile_path, 'w') as f: f.write("""