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

test_write_if_different is prone to race conditions #43

Open
mweinelt opened this issue Apr 16, 2022 · 0 comments
Open

test_write_if_different is prone to race conditions #43

mweinelt opened this issue Apr 16, 2022 · 0 comments

Comments

@mweinelt
Copy link

mweinelt commented Apr 16, 2022

Hi, we're seeing the following error on our build hosts with extension-helpers 1.0.0.

    def test_write_if_different(tmpdir):
        filename = str(tmpdir / 'test.txt')
        write_if_different(filename, b'abc')
        time1 = os.path.getmtime(filename)
        time.sleep(0.01)
        write_if_different(filename, b'abc')
        time2 = os.path.getmtime(filename)
        assert time2 == time1
        time.sleep(0.01)
        write_if_different(filename, b'abcd')
        time3 = os.path.getmtime(filename)
>       assert time3 > time1
E       assert 1650038922.0 > 1650038922.0

The mtime resolution depends on the filesystem implementation, so ideally you would choose a higher timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant