def inv(pytestconfig): inv_dict = pytestconfig.cache.get('python/objects.inv', None) if inv_dict is not None: return Inventory(inv_dict) print("Downloading objects.inv") url = 'https://docs.python.org/{v.major}.{v.minor}/objects.inv'.format( v=sys.version_info) inv = Inventory(url=url) pytestconfig.cache.set('python/objects.inv', inv.json_dict()) return inv
def test_cli_stdio_input(self, scratch_path, res_cmp, misc_info, run_cmdline_test, data_format): """Confirm that inventory data can be read on stdin.""" inv1 = Inventory(res_cmp) if data_format is SourceTypes.DictJSON: input_data = json.dumps(inv1.json_dict()) elif data_format is SourceTypes.BytesPlaintext: input_data = inv1.data_file().decode("utf-8") out_path = scratch_path / (misc_info.FNames.MOD + misc_info.Extensions.DEC) with stdio_mgr(input_data) as (in_, out_, err_): run_cmdline_test( ["convert", "plain", "-", str(out_path.resolve())]) inv2 = Inventory(out_path) assert inv1 == inv2