Skip to content
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

bpo-28494: Test existing zipfile working behavior. #15853

Merged
merged 2 commits into from
Sep 10, 2019

Conversation

gpshead
Copy link
Member

@gpshead gpshead commented Sep 10, 2019

Adds unittests for executables with a zipfile appended to test_zipfile
as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.

This is being added as a regression test that #5053 would otherwise fail today.

https://bugs.python.org/issue28494

Adds unittests for executables with a zipfile appended to test_zipfile
as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
@gpshead
Copy link
Member Author

gpshead commented Sep 10, 2019

duh, fixing the test to skip the execute one on windows :)

@@ -2496,11 +2496,15 @@ def test_read_zip64_with_exe_prepended(self):
self._test_zip_works(self.exe_zip64)

@unittest.skipUnless(sys.executable, 'sys.executable required.')
@unittest.skipUnless(os.access('/bin/bash', os.X_OK),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using shutil.which('bash') instead? There are some windows machines with bash installed now... will the test work there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think windows supported #! line executables as a concept. executable is based on filename ending in bat/cmd/com/exe, not an execute bit there.

@Yhg1s Yhg1s merged commit 3f4db4a into python:master Sep 10, 2019
@gpshead gpshead added the needs backport to 3.8 only security fixes label Sep 10, 2019
@miss-islington
Copy link
Contributor

Thanks @gpshead for the PR, and @Yhg1s for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-15891 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Sep 10, 2019
@gpshead gpshead deleted the new_zipfile_test branch September 10, 2019 22:23
miss-islington added a commit that referenced this pull request Sep 10, 2019
Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
(cherry picked from commit 3f4db4a)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot x86 Gentoo Installed with X 3.8 has failed when building commit 74b0291.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/230/builds/317) and take a look at the build logs.
  4. Check if the failure is related to this commit (74b0291) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/230/builds/317

Failed tests:

  • test_zipfile

Failed subtests:

  • test_read_zip64_with_exe_prepended - test.test_zipfile.TestExecutablePrependedZip
  • test_read_zip_with_exe_prepended - test.test_zipfile.TestExecutablePrependedZip
  • test_execute_zip64 - test.test_zipfile.TestExecutablePrependedZip
  • test_execute_zip2 - test.test_zipfile.TestExecutablePrependedZip

Summary of the results of the build (if available):

== Tests result: FAILURE then FAILURE ==

411 tests OK.

1 test failed:
test_zipfile

11 tests skipped:
test_asdl_parser test_clinic test_devpoll test_gdb test_kqueue
test_msilib test_startfile test_winconsoleio test_winreg
test_winsound test_zipfile64

1 re-run test:
test_zipfile

Total duration: 24 min 26 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2469, in test_read_zip64_with_exe_prepended
    self._test_zip_works(self.exe_zip64)
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2457, in _test_zip_works
    self.assertTrue(zipfile.is_zipfile(name),
AssertionError: False is not true : is_zipfile failed on ziptestdata/exe_with_z64


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2482, in test_execute_zip64
    output = subprocess.check_output([self.exe_zip64, sys.executable])
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 845, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 1689, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ziptestdata/exe_with_z64'


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2466, in test_read_zip_with_exe_prepended
    self._test_zip_works(self.exe_zip)
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2457, in _test_zip_works
    self.assertTrue(zipfile.is_zipfile(name),
AssertionError: False is not true : is_zipfile failed on ziptestdata/exe_with_zip


Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/test/test_zipfile.py", line 2475, in test_execute_zip2
    output = subprocess.check_output([self.exe_zip, sys.executable])
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 845, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/buildbot/buildarea/cpython/3.8.ware-gentoo-x86.installed/build/target/lib/python3.8/subprocess.py", line 1689, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'ziptestdata/exe_with_zip'

@Yhg1s
Copy link
Member

Yhg1s commented Sep 11, 2019

Buildbot failure should have been fixed by GH-15902.

websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
@thomaswaldmann thomaswaldmann mannequin mentioned this pull request Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants