summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/control.rst
diff options
context:
space:
mode:
authorBarry Warsaw2017-07-22 03:02:06 +0000
committerBarry Warsaw2017-07-22 03:02:06 +0000
commit02826321d0430d7ffc1f674eeff4221941689ef7 (patch)
tree1a8e56dff0eab71e58e5fc9ecc5f3c614d7edca7 /src/mailman/commands/docs/control.rst
parentf54c045519300f6f70947d1114f46c2b8ae0d368 (diff)
parentf00b94f18e1d82d1488cbcee6053f03423bc2f49 (diff)
downloadmailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.gz
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.zst
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.zip
Diffstat (limited to 'src/mailman/commands/docs/control.rst')
-rw-r--r--src/mailman/commands/docs/control.rst53
1 files changed, 12 insertions, 41 deletions
diff --git a/src/mailman/commands/docs/control.rst b/src/mailman/commands/docs/control.rst
index b268b50a4..446c3652f 100644
--- a/src/mailman/commands/docs/control.rst
+++ b/src/mailman/commands/docs/control.rst
@@ -13,29 +13,22 @@ All we care about is the master process; normally it starts a bunch of
runners, but we don't care about any of them, so write a test configuration
file for the master that disables all the runners.
- >>> from mailman.commands.tests.test_control import make_config
+ >>> from mailman.commands.tests.test_cli_control import make_config
+ >>> make_config(cleanups)
Starting
========
- >>> from mailman.commands.cli_control import Start
- >>> start = Start()
-
- >>> class FakeArgs:
- ... force = False
- ... run_as_user = True
- ... quiet = False
- ... config = make_config()
- >>> args = FakeArgs()
+ >>> command = cli('mailman.commands.cli_control.start')
Starting the daemons prints a useful message and starts the master watcher
process in the background.
- >>> start.process(args)
+ >>> command('mailman start')
Starting Mailman's master runner
- >>> from mailman.commands.tests.test_control import find_master
+ >>> from mailman.commands.tests.test_cli_control import find_master
The process exists, and its pid is available in a run time file.
@@ -51,34 +44,12 @@ You can also stop the master watcher process from the command line, which
stops all the child processes too.
::
- >>> from mailman.commands.cli_control import Stop
- >>> stop = Stop()
- >>> stop.process(args)
+ >>> command = cli('mailman.commands.cli_control.stop')
+ >>> command('mailman stop')
Shutting down Mailman's master runner
- >>> from datetime import datetime, timedelta
- >>> import os
- >>> import time
- >>> import errno
- >>> def bury_master():
- ... until = timedelta(seconds=2) + datetime.now()
- ... while datetime.now() < until:
- ... time.sleep(0.1)
- ... try:
- ... os.kill(pid, 0)
- ... os.waitpid(pid, os.WNOHANG)
- ... except OSError as error:
- ... if error.errno == errno.ESRCH:
- ... # The process has exited.
- ... print('Master process went bye bye')
- ... return
- ... else:
- ... raise
- ... else:
- ... raise AssertionError('Master process lingered')
-
- >>> bury_master()
- Master process went bye bye
-
-
-XXX We need tests for restart (SIGUSR1) and reopen (SIGHUP).
+..
+ # Clean up.
+ >>> from mailman.commands.tests.test_cli_control import (
+ ... kill_with_extreme_prejudice)
+ >>> kill_with_extreme_prejudice(pid)