Barry Warsaw pushed to branch click-cli at mailman / Mailman Core
Commits:
66dfa1a1 by Barry Warsaw at 2017-07-18T08:39:34-04:00
Boost coverage.
Remove the debugging `locale` test.
- - - - -
3 changed files:
- .gitlab-ci.yml
- src/mailman/commands/tests/test_cli_control.py
- tox.ini
Changes:
=====================================
.gitlab-ci.yml
=====================================
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,11 +12,6 @@ variables:
MYSQL_DATABASE: "test_mailman"
LC_ALL: "C.UTF-8"
-locale:
- script:
- - printenv
- - locale
-
qa:
script:
- tox -e qa
=====================================
src/mailman/commands/tests/test_cli_control.py
=====================================
--- a/src/mailman/commands/tests/test_cli_control.py
+++ b/src/mailman/commands/tests/test_cli_control.py
@@ -29,7 +29,8 @@ from click.testing import CliRunner
from contextlib import ExitStack, suppress
from datetime import datetime, timedelta
from flufl.lock import SEP
-from mailman.commands.cli_control import start
+from mailman.bin.master import WatcherState
+from mailman.commands.cli_control import reopen, restart, start
from mailman.config import config
from mailman.testing.helpers import configuration
from mailman.testing.layers import ConfigLayer
@@ -159,9 +160,7 @@ def kill_with_extreme_prejudice(pid_or_pidfile=None):
print('WARNING: SIGKILL DID NOT EXIT PROCESS!', file=sys.stderr)
-class TestBinDir(unittest.TestCase):
- """Test issues related to bin_dir, e.g. issue #3"""
-
+class TestControl(unittest.TestCase):
layer = ConfigLayer
maxDiff = None
@@ -252,3 +251,45 @@ class TestBinDir(unittest.TestCase):
self.assertEqual(len(self._execl.call_args_list), 1)
posargs, kws = self._execl.call_args_list[0]
self.assertIn('--force', posargs)
+
+
+class TestControlSimple(unittest.TestCase):
+ layer = ConfigLayer
+ maxDiff = None
+
+ def setUp(self):
+ self._command = CliRunner()
+
+ def test_watcher_state_conflict(self):
+ with patch('mailman.commands.cli_control.master_state',
+ return_value=(WatcherState.conflict, object())):
+ results = self._command.invoke(start)
+ self.assertEqual(results.exit_code, 2)
+ self.assertEqual(
+ results.output,
+ 'Usage: start [OPTIONS]\n\n'
+ 'Error: GNU Mailman is already running\n')
+
+ def test_reopen(self):
+ with patch('mailman.commands.cli_control.kill_watcher') as mock:
+ result = self._command.invoke(reopen)
+ mock.assert_called_once_with(signal.SIGHUP)
+ self.assertEqual(result.output, 'Reopening the Mailman runners\n')
+
+ def test_reopen_quiet(self):
+ with patch('mailman.commands.cli_control.kill_watcher') as mock:
+ result = self._command.invoke(reopen, ('--quiet',))
+ mock.assert_called_once_with(signal.SIGHUP)
+ self.assertEqual(result.output, '')
+
+ def test_restart(self):
+ with patch('mailman.commands.cli_control.kill_watcher') as mock:
+ result = self._command.invoke(restart)
+ mock.assert_called_once_with(signal.SIGUSR1)
+ self.assertEqual(result.output, 'Restarting the Mailman runners\n')
+
+ def test_restart_quiet(self):
+ with patch('mailman.commands.cli_control.kill_watcher') as mock:
+ result = self._command.invoke(restart, ('--quiet',))
+ mock.assert_called_once_with(signal.SIGUSR1)
+ self.assertEqual(result.output, '')
=====================================
tox.ini
=====================================
--- a/tox.ini
+++ b/tox.ini
@@ -10,7 +10,7 @@ commands =
cov,diffcov: python -m coverage combine {[coverage]rc}
cov: python -m coverage html {[coverage]rc}
cov: python -m coverage report -m {[coverage]rc} --fail-under=93
- diffcov: python -m coverage xml -i {[coverage]rc}
+ diffcov: python -m coverage xml {[coverage]rc}
diffcov: diff-cover coverage.xml --html-report diffcov.html
diffcov: diff-cover coverage.xml --fail-under=100
#sitepackages = True
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/66dfa1a1479fc6c0fcddaeeb3e9e68274af71172
---
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/66dfa1a1479fc6c0fcddaeeb3e9e68274af71172
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org