コード例 #1
0
ファイル: test_ll_os_stat.py プロジェクト: Darriall/pypy
    def test_stat(self):
        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, +- rounding error
            expected = int(os.stat(f).st_mtime*1000)
            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'])
        check(sys.executable)
コード例 #2
0
    def test_stat(self):
        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):
            expected = os.stat(f).st_mtime
            assert stat(f).st_mtime == expected
            assert wstat(unicode(f)).st_mtime == expected

        check("c:/")
        check(os.environ["TEMP"])
        check("c:/pagefile.sys")
コード例 #3
0
ファイル: test_ll_os_stat.py プロジェクト: sota/pypy-old
    def test_stat(self):
        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, +- rounding error
            expected = int(os.stat(f).st_mtime * 1000)
            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'])
        check(sys.executable)
コード例 #4
0
ファイル: test_ll_os_stat.py プロジェクト: Darriall/pypy
 def test_stat_large_number(self):
     if sys.version_info < (2, 7):
         py.test.skip('requires Python 2.7')
     fname = udir.join('test_stat_large_number.txt')
     fname.ensure()
     t1 = 5000000000.0
     os.utime(str(fname), (t1, t1))
     stat = ll_os_stat.make_win32_stat_impl('stat', ll_os.StringTraits())
     assert stat(str(fname)).st_mtime == t1
コード例 #5
0
ファイル: test_ll_os_stat.py プロジェクト: sota/pypy-old
 def test_stat_large_number(self):
     if sys.version_info < (2, 7):
         py.test.skip('requires Python 2.7')
     fname = udir.join('test_stat_large_number.txt')
     fname.ensure()
     t1 = 5000000000.0
     os.utime(str(fname), (t1, t1))
     stat = ll_os_stat.make_win32_stat_impl('stat', ll_os.StringTraits())
     assert stat(str(fname)).st_mtime == t1
コード例 #6
0
ファイル: test_ll_os_stat.py プロジェクト: Darriall/pypy
 def test_fstat(self):
     fstat = ll_os_stat.make_win32_stat_impl('fstat', ll_os.StringTraits())
     stat = fstat(0) # stdout
     assert stat.st_mode != 0
コード例 #7
0
ファイル: test_ll_os_stat.py プロジェクト: sota/pypy-old
 def test_fstat(self):
     fstat = ll_os_stat.make_win32_stat_impl('fstat', ll_os.StringTraits())
     stat = fstat(0)  # stdout
     assert stat.st_mode != 0