Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Skip test_copyfile_nonexistent_dir in AIX #92670

Closed
Labels
testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
@ayappanec

Description

@ayappanec

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 issuehttps://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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp