Skip to content

Commit

Permalink
Make the dump print more reasonable (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian authored Apr 23, 2024
1 parent 343e130 commit a8532d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/coredumpy/except_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _excepthook(type, value, traceback):

filename = dump(traceback.tb_frame, path=path, directory=directory)
_original_excepthook(type, value, traceback)
print(f'Your frame stack has been dumped to "{filename}", '
f'open it with\ncoredumpy load {filename}')
print(f'Your frame stack is dumped, open it with\n'
f'coredumpy load {filename}')

sys.excepthook = _excepthook
8 changes: 4 additions & 4 deletions src/coredumpy/unittest_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def addError(self, test, err):
tb = tb.tb_next
try:
filename = dump(tb.tb_frame, path=path, directory=directory)
print(f'Your frame stack has been dumped to "{filename}", '
f'open it with\ncoredumpy load {filename}')
print(f'Your frame stack is dumped, open it with\n'
f'coredumpy load {filename}')
except Exception: # pragma: no cover
pass
_original_addError(self, test, err)
Expand All @@ -40,8 +40,8 @@ def addFailure(self, test, err):
tb = tb.tb_next
try:
filename = dump(tb.tb_frame, path=path, directory=directory)
print(f'Your frame stack has been dumped to "{filename}", '
f'open it with\ncoredumpy load {filename}')
print(f'Your frame stack is dumped, open it with\n'
f'coredumpy load {filename}')
except Exception: # pragma: no cover
pass
_original_addFailure(self, test, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def test_error(self):
self.assertIn("FAIL: test_eq", stderr)
self.assertIn("ERROR: test_error", stderr)
self.assertNotIn("test_pass", stderr)
self.assertEqual(stdout.count(tempdir), 6)
self.assertEqual(stdout.count(tempdir), 3)
self.assertEqual(len(os.listdir(tempdir)), 3)

0 comments on commit a8532d0

Please sign in to comment.