-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test suite immediately aborts with a successful exit code whenever a test that does a pipenv run
executes
#4909
Comments
This documents a workaround for pypa#4909. It feels a bit weird to me that developers have to pretend to be CI just to run the test suite, thoug. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is just bogus. It unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. `make tests` (mentioned in RELEASING.md) also didn't work for me. I added the `CI=1` workaround from pypa#4909 to get it working. 5. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 6. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
This documents a workaround for pypa#4909. It feels a bit weird to me that developers have to pretend to be CI just to run the test suite, thoug. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is just bogus. It unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: ```bash $ make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 ``` The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. `make tests` (mentioned in RELEASING.md) also didn't work for me. I added the `CI=1` workaround from pypa#4909 to get it working. 5. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 6. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
This documents a workaround for pypa#4909. It feels a bit weird to me that developers have to pretend to be CI just to run the test suite, thoug. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is just bogus. It unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: ```bash $ make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 ``` The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. `make tests` (mentioned in RELEASING.md) also didn't work for me. I added the `CI=1` workaround from pypa#4909 to get it working. 5. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 6. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
This documents a workaround for pypa#4909. It feels a bit weird to me that developers have to pretend to be CI just to run the test suite, though. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is bogus. It's unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: ```bash $ make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 ``` The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. `make tests` (mentioned in RELEASING.md) also didn't work for me. I added the `CI=1` workaround from pypa#4909 to get it working. 5. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 6. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
This adds and documents a workaround for pypa#4909. It feels a bit weird to pretend to be CI just to run the test suite, though. Maybe we can do something about that later. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is bogus. It's unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: ```bash $ make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 ``` The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 5. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
This adds and documents a workaround for pypa#4909. It feels a bit weird to pretend to be CI just to run the test suite, though. Maybe we can do something about that later. I ran into a lot of trouble trying to get the tests to run when working on pypa#4908, and that was largely because the instructions in this CONTRIBUTING.md file seem to have rotted. 1. The bit about "can be run very simply" is bogus. It's unfortunately not that simple right now. 2. `make test` (the docker approach) fails for me with this error: ```bash $ make test docker-compose up [+] Running 1/0 ⠿ Container pipenv-pipenv-tests-1 Recreated 0.1s Attaching to pipenv-pipenv-tests-1 pipenv-pipenv-tests-1 | Collecting certifi pipenv-pipenv-tests-1 | Downloading https://files.pythonhosted.org/packages/37/45/946c02767aabb873146011e665728b680884cd8fe70dde973c640e45b775/certifi-2021.10.8-py2.py3-none-any.whl (149kB) pipenv-pipenv-tests-1 | Installing collected packages: certifi pipenv-pipenv-tests-1 | Successfully installed certifi-2021.10.8 pipenv-pipenv-tests-1 | Path: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin pipenv-pipenv-tests-1 | Installing Pipenv... pipenv-pipenv-tests-1 | Obtaining file:///pipenv pipenv-pipenv-tests-1 | Complete output from command python setup.py egg_info: pipenv-pipenv-tests-1 | Traceback (most recent call last): pipenv-pipenv-tests-1 | File "<string>", line 1, in <module> pipenv-pipenv-tests-1 | File "/pipenv/setup.py", line 55 pipenv-pipenv-tests-1 | print(f"\033[1m{s}\033[0m") pipenv-pipenv-tests-1 | ^ pipenv-pipenv-tests-1 | SyntaxError: invalid syntax pipenv-pipenv-tests-1 | pipenv-pipenv-tests-1 | ---------------------------------------- pipenv-pipenv-tests-1 | Command "python setup.py egg_info" failed with error code 1 in /pipenv/ pipenv-pipenv-tests-1 exited with code 1 ``` The docker image it relies upon (https://hub.docker.com/r/kennethreitz/pipenv-tests) hasn't been updated in 4 years, so I assume it's just not something people use anymore? 3. Relatedly, there was a `Dockerfile` at the root of this repo that appears to be unused. Let me know if it's used somewhere I'm not realizing, I can add it back! 4. https://kennethreitz.org/essays/be-cordial-or-be-on-your-way seems to be a broken link now. I found https://kennethreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way on Google. 5. `./run-tests.sh` doesn't work for me. It's failing for the same reason described by @ncoghlan here: pypa/pip#7953 (comment). He said something about a `PIPENV_BOOTSTRAP` environment variable, but I can't find any information about that.
@jfly I haven't experienced this issue before in the last months of running pipenv tests locally on almost daily basis. Could you re-check this behavior with |
@matteius that's because of this workaround I added. If you comment it out, this reproduces quickly:
|
@jfly sorry for being dense but is this still an issue? |
@matteius sorry for the delayed response here. I just checked, and yes, this is still an issue. I've filed this SO question seeking help from the click folks about how to handle this: https://stackoverflow.com/questions/73995157/best-practice-for-invoke-ing-a-tool-that-internally-calls-exec. |
Hi! https://github.com/pypa/pipenv/blob/main/pipenv/routines/shell.py#L102 we have a script that runs something like this is because when the $CI env var is set, run uses |
Urg, sorry @scvsoft-javierrotelli, that must have been a pain to track down. One solution would be to change that workaround to look at a new environment variable ( |
Its been a while on this thread but I am wondering how relevant that pipenv logic for nt is still, but it might be -- anyway I am pretty busy at the moment but could accept a PR and cut a minor release sometime soon. |
a new env variable seems like a good solution, I can work on a PR between today and tomorrow if that's fine |
heh, It was hard to find out. but a good exercise nonetheless |
I don't know anything about pipenv on windows, but I am pretty confident the workaround described in this issue is still necessary. The fact that the string "nt" is part of this is pretty confusing, it's just about if we're using
@scvsoft-javierrotelli, thanks! I'm not a maintainer (so I won't be able to merge your changes), but I can give you a code review. |
@jfly the only test that fails in the CI without any of that legacy patch is an oddly written test |
@jfly and the test that failed was literally checking if not os nt then compare to the wrong string for not found (it was could not be found) "not found" != "not be found" -- anyway, if you want to take a look at the PR i'll add a news fragment later and then I think @scvsoft-javierrotelli won't need to open anything for this issue. |
@matteius I hadn't realized the |
Check this out:
I know we don't have a 7 second test suite with only 3 tests in it! Also, where did pipenv's normal test summary go?
In the example above, we've run the first 3 tests of test_cli.py and the test suite aborted when running the 4th test:
test_pipenv_site_packages
. The whole test suite aborts when we get to thispipenv run
invocation:pipenv/tests/integration/test_cli.py
Line 52 in b0ebaf0
This doesn't happen in CI. It took me forever to figure out what's going on here. Here's the full story:
p.pipenv
usesclick
'sinvoke
method internally. That method internally starts executing pipenv (note that this is happening in the same python testrunner process, there is no forking going on here!)pipenv run
, which (on my Linux machine) means we execute this call toos.execve
indo_run_posix
. This completely replaces the pytest process we were in the middle of, and when the (now just pipenv) process exits, our entire test suite grinds to a halt and exits successfully. Yikes 🤯!do_run_nt
(:interrobang:) in CI:pipenv/pipenv/core.py
Lines 2499 to 2502 in b0ebaf0
I've been able to work around this problem by explicitly setting the
CI
environment variable when running tests locally. I'll send in a PR to improve the documentation, but we might want to rework this a bit. It feels a bit off to require people to pretend to be in CI just to run tests.The text was updated successfully, but these errors were encountered: