test_common.py 文件源码

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

项目:raspbian-qemu 作者: meadowface 项目源码 文件源码
def callTool(self, args):
        """Call the raspbian-qemu tool with a check for a kept root.img."""
        # Clean up any root images so we can assert whether it's created
        # or not after the run.
        if os.path.exists(self.ROOT_IMG):
            os.unlink(self.ROOT_IMG)

        cmd = [TOOL]
        # Assume any time the trace function is set it's coverage and make
        # sure to spawn the tool under coverage as well.
        if sys.gettrace():
            cmd = ["python3-coverage", "run", "--parallel-mode"] + cmd
        subprocess.check_output(cmd + args, stderr=subprocess.STDOUT)

        # Now make sure root.img was created if request but not if it wasn't.
        # If created correctly, check its state and then clean it up.
        keep_root = "--keep-root" in args
        self.assertEqual(os.path.exists(self.ROOT_IMG), keep_root)
        if keep_root:
            self.assertOnlyUserReadable(self.ROOT_IMG)
            os.unlink(self.ROOT_IMG)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号