FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-127146: Mark test_bz2 tests with requires_subprocess by hoodmane · Pull Request #127562 · python/cpython · GitHub

/ cpython Public

gh-127146: Mark test_bz2 tests with requires_subprocess - #127562

Closed
hoodmane wants to merge 1 commit into
python:mainfrom
hoodmane:bz2-tests-requires-subprocess
Closed

gh-127146: Mark test_bz2 tests with requires_subprocess#127562
hoodmane wants to merge 1 commit into
python:mainfrom
hoodmane:bz2-tests-requires-subprocess

Conversation

hoodmane commented Dec 3, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

hoodmane requested a review from freakboy3742 December 3, 2024 13:53
bedevere-app Bot added tests Tests in the Lib/test dir awaiting review labels Dec 3, 2024

Copy link
Copy Markdown
Contributor

This doesn't seem quite right - iOS and Android don't support subprocesses, but have no problem implementing the bz2 tests. How are you seeing this problem manifest?

hoodmane commented Dec 3, 2024

Copy link
Copy Markdown
Contributor Author
Traceback (most recent call last):
  File "/home/rchatham/cpython/Lib/test/test_bz2.py", line 252, in testWrite
    self.assertEqual(ext_decompress(f.read()), self.TEXT)
                     ~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/rchatham/cpython/Lib/test/test_bz2.py", line 34, in ext_decompress
    return subprocess.check_output(['bunzip2'], input=data)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rchatham/cpython/Lib/subprocess.py", line 472, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
               **kwargs).stdout
               ^^^^^^^^^
  File "/home/rchatham/cpython/Lib/subprocess.py", line 554, in run
    with Popen(*popenargs, **kwargs) as process:
         ~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rchatham/cpython/Lib/subprocess.py", line 824, in __init__
    raise OSError(
        errno.ENOTSUP, f"{sys.platform} does not support processes."
    )
OSError: [Errno 138] emscripten does not support processes.

hoodmane commented Dec 3, 2024

Copy link
Copy Markdown
Contributor Author

Looking at ext_decompress:

def ext_decompress(data):
    global has_cmdline_bunzip2
    if has_cmdline_bunzip2 is None:
        has_cmdline_bunzip2 = bool(shutil.which('bunzip2'))
    if has_cmdline_bunzip2:
        return subprocess.check_output(['bunzip2'], input=data)
    else:
        return bz2.decompress(data)

Looks like the problem is that shutil.which('bunzip2') returns something truthy for some reason.

hoodmane commented Dec 3, 2024

Copy link
Copy Markdown
Contributor Author
$ ./python.sh -c "import shutil; print(shutil.which('bunzip2'))"
/usr/bin/bunzip2

Okay the problem is that in node_entry.mjs I should do one or both of:

  1. not propagate the PATH environment variable or
  2. not mount the /usr directory.

hoodmane commented Dec 3, 2024

Copy link
Copy Markdown
Contributor Author

Thanks @freakboy3742!

hoodmane closed this Dec 3, 2024
hoodmane deleted the bz2-tests-requires-subprocess branch December 3, 2024 14:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL