Skip to content

Commit

Permalink
Add note on a doctest that randomly behaves
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Jun 12, 2023
1 parent 443b754 commit a29d22e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/sage/doctest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,24 @@
Even though the doctester master process has exited, the child process
is still alive, but it should be killed automatically
after the `die_timeout` given above (10 seconds)::
after the ``die_timeout`` given above (10 seconds)::
sage: pid = int(open(F).read()) # long time
sage: time.sleep(2) # long time
sage: os.kill(pid, signal.SIGQUIT) # long time; 2 seconds passed => still alive
sage: time.sleep(8) # long time
sage: os.kill(pid, signal.SIGQUIT) # long time; 10 seconds passed => dead
sage: os.kill(pid, signal.SIGQUIT) # long time; 10 seconds passed => dead # random
Traceback (most recent call last):
...
ProcessLookupError: ...
If the child process is dead and removed, the last output should be as above.
However, the child process interrupted its parent process (see
``"interrupt_diehard.rst"``), and became an orphan process. Depending on the
system, an orphan process may eventually become a zombie process instead of
being removed, and then the last output would just be a blank. Hence the ``#
random`` tag.
Test a doctest failing with ``abort()``::
sage: subprocess.call(["sage", "-t", "--warn-long", "0", # long time
Expand Down

0 comments on commit a29d22e

Please sign in to comment.