Author: mattip <matti.pi...@gmail.com> Branch: win32-fixes5 Changeset: r73728:857bafb8905f Date: 2014-09-27 23:14 +0300 http://bitbucket.org/pypy/pypy/changeset/857bafb8905f/
Log: account for rounding error in st_mtime resolution diff --git a/rpython/rtyper/module/test/test_ll_os_stat.py b/rpython/rtyper/module/test/test_ll_os_stat.py --- a/rpython/rtyper/module/test/test_ll_os_stat.py +++ b/rpython/rtyper/module/test/test_ll_os_stat.py @@ -22,10 +22,10 @@ stat = ll_os_stat.make_win32_stat_impl('stat', ll_os.StringTraits()) wstat = ll_os_stat.make_win32_stat_impl('stat', ll_os.UnicodeTraits()) def check(f): - # msec resolution + # msec resolution, +- rounding error expected = int(os.stat(f).st_mtime*1000) - assert int(stat(f).st_mtime*1000) == expected - assert int(wstat(unicode(f)).st_mtime*1000) == expected + assert abs(int(stat(f).st_mtime*1000) - expected) < 2 + assert abs(int(wstat(unicode(f)).st_mtime*1000) - expected) < 2 check('c:/') check(os.environ['TEMP']) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit