文件操作 - test_inventory.py
返回文件管理
返回主菜单
删除本文件
文件: /snap/lxd/38800/lib/python3/dist-packages/ceph/tests/test_inventory.py
编辑文件内容
import json import os import pytest from ceph.deployment.inventory import Devices @pytest.mark.parametrize("filename", [ os.path.dirname(__file__) + '/c-v-inventory.json', os.path.dirname(__file__) + '/../../../pybind/mgr/test_orchestrator/du' 'mmy_data.json', ]) def test_from_json(filename): with open(filename) as f: data = json.load(f) if 'inventory' in data: data = data['inventory'] ds = Devices.from_json(data) assert len(ds.devices) == len(data) assert Devices.from_json(ds.to_json()) == ds
修改文件时间
将文件时间修改为当前时间的前一年
删除文件