MCPcopy
hub / github.com/pytest-dev/pytest / load_and_is_true

Method load_and_is_true

doc/en/example/multipython.py:48–64  ·  doc/en/example/multipython.py::Python.load_and_is_true
(self, expression)

Source from the content-addressed store, hash-verified

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

Callers 1

test_basic_objectsFunction · 0.80

Calls 2

write_textMethod · 0.80
runMethod · 0.45

Tested by 1

test_basic_objectsFunction · 0.64