MCPcopy Create free account
hub / github.com/python-cmd2/cmd2 / test_history_file_bad_json

Function test_history_file_bad_json

tests/test_history.py:934–947  ·  view source on GitHub ↗
(mocker, capsys)

Source from the content-addressed store, hash-verified

932
933
934def test_history_file_bad_json(mocker, capsys) -> None:
935 import lzma
936
937 data = b"THIS IS NOT JSON"
938 compressed_data = lzma.compress(data)
939
940 history_file = "/tmp/doesntmatter"
941 with open(history_file, "wb") as f:
942 f.write(compressed_data)
943
944 cmd2.Cmd(persistent_history_file=history_file)
945 out, err = capsys.readouterr()
946 assert not out
947 assert "Error processing persistent history data" in err
948
949
950def test_history_populates_pt(hist_file) -> None:

Callers

nothing calls this directly

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…