Skip to content

Skip test_copyfile_nonexistent_dir in AIX #92670

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
ayappanec opened this issue May 11, 2022 · 2 comments
Closed

Skip test_copyfile_nonexistent_dir in AIX #92670

ayappanec opened this issue May 11, 2022 · 2 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@ayappanec
Copy link
Contributor

test_copyfile_nonexistent_dir fails in AIX.

======================================================================
FAIL: test_copyfile_nonexistent_dir (test.test_shutil.TestCopy)

Traceback (most recent call last):
File "/python3_work/Python-3.9.12/Lib/test/test_shutil.py", line 1276, in test_copyfile_nonexistent_dir
self.assertRaises(FileNotFoundError, shutil.copyfile, src_file, dst)
AssertionError: FileNotFoundError not raised by copyfile


From the testcase.,
def test_copyfile_nonexistent_dir(self):
# Issue 43219
src_dir = self.mkdtemp()
src_file = os.path.join(src_dir, 'foo')
dst = os.path.join(src_dir, 'does_not_exist/')
write_file(src_file, 'foo')
self.assertRaises(FileNotFoundError, shutil.copyfile, src_file, dst)

It assumes that having a trailing slash ( 'does_not_exist/' ) makes the OS to consider it as directory. It is discussed more in this issue https://bugs.python.org/issue43219 . But in AIX, it is not the case. The trailing slash has no effect. It is considered as a file and get created. That is atleast how the AIX open call behaviour is.

import os
src_dir = 'temp_dir'
src_file = os.path.join(src_dir, 'foo')
dst = os.path.join(src_dir, 'does_not_exist/')
assert not os.path.exists(dst)
with open(dst, 'wb') as fp:
fp.write(b'foo')

Running the above in AIX, it creates the file does_not_exist.

The testcase is skipped for other distros like MacOS, Solaris because of different errors thrown. For AIX also, this testcase needs to be skipped , though for a different reason.

@ayappanec ayappanec added the type-bug An unexpected behavior, bug, or error label May 11, 2022
@AlexWaygood AlexWaygood added the tests Tests in the Lib/test dir label May 11, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 19, 2022
…ir on AIX (pythonGH-92718)

(cherry picked from commit 654032a)

Co-authored-by: Ayappan Perumal <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 19, 2022
…ir on AIX (pythonGH-92718)

(cherry picked from commit 654032a)

Co-authored-by: Ayappan Perumal <[email protected]>
@erlend-aasland
Copy link
Contributor

miss-islington added a commit that referenced this issue May 19, 2022
…AIX (GH-92718)

(cherry picked from commit 654032a)

Co-authored-by: Ayappan Perumal <[email protected]>
miss-islington added a commit that referenced this issue May 19, 2022
…AIX (GH-92718)

(cherry picked from commit 654032a)

Co-authored-by: Ayappan Perumal <[email protected]>
@ayappanec
Copy link
Contributor Author

Thanks @erlend-aasland for the review and merge.

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

3 participants