Skip to content

[tests] When test_venv.test_with_pip() fails, a bug in error handling fails to display stderr #97764

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

Closed
vstinner opened this issue Oct 3, 2022 · 2 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented Oct 3, 2022

https://buildbot.python.org/all/#/builders/719/builds/1696

ERROR: test_with_pip (test.test_venv.EnsurePipTest.test_with_pip)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 660, in nicer_error
    yield
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 595, in do_test_with_pip
    self.run_with_capture(venv.create, self.env_dir,
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 87, in run_with_capture
    func(*args, **kwargs)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/venv/__init__.py", line 459, in create
    builder.create(env_dir)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/venv/__init__.py", line 76, in create
    self._setup_pip(context)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/venv/__init__.py", line 349, in _setup_pip
    subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/subprocess.py", line 465, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/subprocess.py", line 569, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/test_python_92rnuaxl/tmpkaiesc24/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 672, in test_with_pip
    self.do_test_with_pip(False)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 594, in do_test_with_pip
    with self.nicer_error():
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/contextlib.py", line 155, in __exit__
    self.gen.throw(value)
  File "/buildbot/buildarea/3.x.pablogsal-arch-x86_64.clang-ubsan/build/Lib/test/test_venv.py", line 663, in nicer_error
    err = exc.stderr.decode(errors="replace")
          ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'decode'
@vstinner vstinner added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Oct 3, 2022
@dorosch
Copy link
Contributor

dorosch commented Oct 21, 2022

Hello @vstinner
Looks like this has been fixed in #98263

@vstinner
Copy link
Member Author

vstinner commented Nov 3, 2022

Cool! I close my issue.

@vstinner vstinner closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants