From 15149f0091c757689249aee04a6afc87895289a3 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 31 Jan 2024 21:40:52 -0500 Subject: [PATCH] Remove forcing CI code path to use nt shell code path (#6072) * Remove forcing CI code path to use nt shell code path and remove outdated comment * Add news fragment --- news/6072.bugfix.rst | 1 + pipenv/routines/shell.py | 5 +---- tests/conftest.py | 10 ---------- tests/integration/test_run.py | 4 ++-- 4 files changed, 4 insertions(+), 16 deletions(-) create mode 100644 news/6072.bugfix.rst diff --git a/news/6072.bugfix.rst b/news/6072.bugfix.rst new file mode 100644 index 00000000..a6210034 --- /dev/null +++ b/news/6072.bugfix.rst @@ -0,0 +1 @@ +Remove logic that treats ``CI`` variable to use ``do_run_nt`` shell logic, as the original reasons for that patch were no longer valid. diff --git a/pipenv/routines/shell.py b/pipenv/routines/shell.py index a4a4df62..1e8b286b 100644 --- a/pipenv/routines/shell.py +++ b/pipenv/routines/shell.py @@ -3,7 +3,6 @@ import subprocess import sys from os.path import expandvars -from pipenv import environments from pipenv.utils.project import ensure_project from pipenv.utils.shell import cmd_list_to_shell, system_which from pipenv.vendor import click @@ -99,9 +98,7 @@ def do_run(project, command, args, python=False, pypi_mirror=None): click.echo("Can't run script {0!r}-it's empty?", err=True) run_args = [project, script] run_kwargs = {"env": env} - # We're using `do_run_nt` on CI (even if we're running on a non-nt machine) - # as a workaround for https://github.com/pypa/pipenv/issues/4909. - if os.name == "nt" or environments.PIPENV_IS_CI: + if os.name == "nt": run_fn = do_run_nt else: run_fn = do_run_posix diff --git a/tests/conftest.py b/tests/conftest.py index 13778403..fc75b6b5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,4 @@ import pytest -import os - -# Note that we have to do this *before* `pipenv.environments` gets imported, -# which is why we're doing it here as a side effect of importing this module. -# CI=1 is necessary as a workaround for https://github.com/pypa/pipenv/issues/4909 -os.environ['CI'] = '1' - -def pytest_sessionstart(session): - import pipenv.environments - assert pipenv.environments.PIPENV_IS_CI @pytest.fixture() diff --git a/tests/integration/test_run.py b/tests/integration/test_run.py index 0cb99d81..2b938aa9 100644 --- a/tests/integration/test_run.py +++ b/tests/integration/test_run.py @@ -41,8 +41,8 @@ multicommand = "bash -c \"cd docs && make html\"" c = p.pipenv('run notfoundscript') assert c.returncode != 0 assert c.stdout == '' - if os.name != 'nt': # TODO: Implement this message for Windows. - assert 'not found' in c.stderr + if os.name != 'nt': + assert 'could not be found' in c.stderr project = Project()