forked from goodboy/tractor
				
			Save an MIA `breakpoint()`-restore test from prior!?
It appears that during the reorg commit a356233b47fcd2431f4414e7a310e4d3a100fc58 this was intended to be moved (presumably where i have here) to `test_tooling` but was somehow just never pasted over XD Good thing this was caught while going through the remaining TODO bullets in goodboy/tractor#2 !! Also includes fixed relative `.conftest` imports!remotes/1757153874605917753/main
							parent
							
								
									66a7d660f6
								
							
						
					
					
						commit
						255db4b127
					
				|  | @ -22,7 +22,7 @@ from tractor.devx._debug import ( | |||
|     _repl_fail_msg as _repl_fail_msg, | ||||
|     _ctlc_ignore_header as _ctlc_ignore_header, | ||||
| ) | ||||
| from conftest import ( | ||||
| from ..conftest import ( | ||||
|     _ci_env, | ||||
| ) | ||||
| 
 | ||||
|  |  | |||
|  | @ -29,7 +29,6 @@ from .conftest import ( | |||
|     _repl_fail_msg, | ||||
| ) | ||||
| from .conftest import ( | ||||
|     _ci_env, | ||||
|     expect, | ||||
|     in_prompt_msg, | ||||
|     assert_before, | ||||
|  |  | |||
|  | @ -19,7 +19,13 @@ import signal | |||
| from .conftest import ( | ||||
|     expect, | ||||
|     assert_before, | ||||
|     # in_prompt_msg, | ||||
|     in_prompt_msg, | ||||
|     PROMPT, | ||||
|     _pause_msg, | ||||
| ) | ||||
| from pexpect.exceptions import ( | ||||
|     # TIMEOUT, | ||||
|     EOF, | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
|  | @ -118,3 +124,50 @@ def test_shield_pause( | |||
|             "'--uid', \"('hanger',", | ||||
|         ] | ||||
|     ) | ||||
| 
 | ||||
| 
 | ||||
| def test_breakpoint_hook_restored( | ||||
|     spawn, | ||||
| ): | ||||
|     ''' | ||||
|     Ensures our actor runtime sets a custom `breakpoint()` hook | ||||
|     on open then restores the stdlib's default on close. | ||||
| 
 | ||||
|     The hook state validation is done via `assert`s inside the | ||||
|     invoked script with only `breakpoint()` (not `tractor.pause()`) | ||||
|     calls used. | ||||
| 
 | ||||
|     ''' | ||||
|     child = spawn('restore_builtin_breakpoint') | ||||
| 
 | ||||
|     child.expect(PROMPT) | ||||
|     assert_before( | ||||
|         child, | ||||
|         [ | ||||
|             _pause_msg, | ||||
|             "<Task '__main__.main'", | ||||
|             "('root'", | ||||
|             "first bp, tractor hook set", | ||||
|         ] | ||||
|     ) | ||||
|     child.sendline('c') | ||||
|     child.expect(PROMPT) | ||||
|     assert_before( | ||||
|         child, | ||||
|         [ | ||||
|             "last bp, stdlib hook restored", | ||||
|         ] | ||||
|     ) | ||||
| 
 | ||||
|     # since the stdlib hook was already restored there should be NO | ||||
|     # `tractor` `log.pdb()` content from console! | ||||
|     assert not in_prompt_msg( | ||||
|         child, | ||||
|         [ | ||||
|             _pause_msg, | ||||
|             "<Task '__main__.main'", | ||||
|             "('root'", | ||||
|         ], | ||||
|     ) | ||||
|     child.sendline('c') | ||||
|     child.expect(EOF) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue