Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

rlib/test/test_rposix_stat.py::test_high_precision_stat_time

@py.test.mark.skipif('sys.platform == "darwin"')
    def test_high_precision_stat_time():
        # we use a fresh dir for our test, as the current directory can
        # receive changes during testing (especially if testing in parallel)
        dirname = os.path.abspath(os.path.join(".", "test" + uuid.uuid1().hex))
        os.mkdir(dirname)
    
        def f():
            st = os.stat(dirname)
            # should be supported on all platforms, but give a result whose
            # precision might be lower than full nanosecond
            highprec = rposix_stat.get_stat_ns_as_bigint(st, "ctime")
            return '%s;%s' % (st.st_ctime, highprec.str())
    
        try:
            fc = compile(f, [])
            as_string = fc()
            asfloat, highprec = as_string.split(';')
            asfloat = float(asfloat)
            highprec = int(highprec)
            st = os.stat(dirname)
            assert abs(asfloat - st.st_ctime) < 500e-9
>           assert abs(highprec - int(st.st_ctime * 1e9)) < 500
E           AssertionError: assert 767259136 < 500
E            +  where 767259136 = abs((1779293702000000000 - 1779293702767259136))
E            +    where 1779293702767259136 = int((1779293702.7672591 * 1000000000.0))
E            +      where 1779293702.7672591 = 1779293702.7672591
E            +        where 1779293702.7672591 = nt.stat_result(st_mode=16895, st_ino=79375943433070554, st_dev=2394200642, st_...integer_atime=1779293702, _integer_mtime=1779293702, _integer_ctime=1779293702).st_ctime

rlib\test\test_rposix_stat.py:118: AssertionError
 (somefailed=True in rlib/test/test_rposix_stat.py)
builder: rpython-win-x86-64 build #404
test: rlib/test/test_rposix_stat/py/test_high_precision_stat_time