test_os.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:ouroboros 作者: pybee 项目源码 文件源码
def setUp(self):
        self.dirname = support.TESTFN
        self.fname = os.path.join(self.dirname, "f1")

        self.addCleanup(support.rmtree, self.dirname)
        os.mkdir(self.dirname)
        with open(self.fname, 'wb') as fp:
            fp.write(b"ABC")

        def restore_float_times(state):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore", DeprecationWarning)

                os.stat_float_times(state)

        # ensure that st_atime and st_mtime are float
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)

            old_float_times = os.stat_float_times(-1)
            self.addCleanup(restore_float_times, old_float_times)

            os.stat_float_times(True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号