Skip to content

UtimeTests fail on file systems which do not store the access time #154427

Description

@serhiy-storchaka

Bug report

9 tests in test_os.UtimeTests fail on DragonFly BSD:

FAIL: test_utime (test.test_os.test_os.UtimeTests.test_utime)
    self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
AssertionError: 4.005006 != 1.002003 within 1e-06 delta

4.005006 is the modification time which the test sets. HAMMER2 does not store the access time, and os.stat() returns the modification time instead. On tmpfs on the same system both are correct:

file system st_atime st_mtime
HAMMER2 4.005006 4.005006
tmpfs 1.002003 4.005006

Affected are test_utime, test_utime_by_indexed, test_utime_by_times, test_utime_decimal, test_utime_dir_fd, test_utime_directory, test_utime_fd, test_utime_fraction and test_utime_nofollow_symlinks -- all of them use the same helper.

The tests already probe the file system for the timestamp resolution (support_subsecond()), so they can probe it for the access time too, and only check the modification time if it is not stored.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests 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