MCPcopy Create free account
hub / github.com/pytest-dev/pytest / load_and_is_true

Method load_and_is_true

doc/en/example/multipython.py:48–66  ·  view source on GitHub ↗
(self, expression)

Source from the content-addressed store, hash-verified

46 subprocess.check_call((self.pythonpath, str(dumpfile)))
47
48 def load_and_is_true(self, expression):
49 loadfile = self.picklefile.with_name("load.py")
50 loadfile.write_text(
51 textwrap.dedent(
52 r"""
53 import pickle
54 f = open({!r}, 'rb')
55 obj = pickle.load(f)
56 f.close()
57 res = eval({!r})
58 if not res:
59 raise SystemExit(1)
60 """.format(
61 str(self.picklefile), expression
62 )
63 )
64 )
65 print(loadfile)
66 subprocess.check_call((self.pythonpath, str(loadfile)))
67
68
69@pytest.mark.parametrize("obj", [42, {}, {1: 3}])

Callers 1

test_basic_objectsFunction · 0.80

Calls 1

formatMethod · 0.45

Tested by 1

test_basic_objectsFunction · 0.64