Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core
Commits:
a2e29398 by Abhilash Raj at 2022-02-23T18:27:12-08:00
Patch the os.geteuid in tests to ensure they work when run as root.
Falcon is trying to setup Mailman as a part of their CI and since
our tests break when run as root, they aren't able to run it. This
ensures that our tests are more independent of the environment.
- - - - -
55c5a04b by Abhilash Raj at 2022-02-24T03:29:09+00:00
Merge branch 'fix-tests' into 'master'
Patch the os.geteuid in tests to ensure they work when run as root.
See merge request mailman/mailman!966
- - - - -
1 changed file:
- src/mailman/bin/tests/test_mailman.py
Changes:
=====================================
src/mailman/bin/tests/test_mailman.py
=====================================
@@ -54,8 +54,11 @@ class TestMailmanCommand(unittest.TestCase):
self._command.invoke(main, ('info',))
init.assert_called_once_with(None)
+ @patch('mailman.bin.mailman.os')
@patch('mailman.bin.mailman.initialize')
- def test_mailman_command_without_subcommand_prints_help(self, mock):
+ def test_mailman_command_without_subcommand_prints_help(
+ self, mock_os, mock):
+ mock_os.geteuid.return_value = 1000
# Issue #137: Running `mailman` without a subcommand raises an
# AttributeError.
result = self._command.invoke(main, [])
@@ -84,8 +87,11 @@ class TestMailmanCommand(unittest.TestCase):
# command line.
self.assertEqual(lines[0], 'Usage: main [OPTIONS] COMMAND [ARGS]...')
+ @patch('mailman.bin.mailman.os')
@patch('mailman.bin.mailman.initialize')
- def test_transaction_commit_after_successful_subcommand(self, mock):
+ def test_transaction_commit_after_successful_subcommand(
+ self, mock_os, mock):
+ mock_os.geteuid.return_value = 0
# Issue #223: Subcommands which change the database need to commit or
# abort the transaction.
with transaction():
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/26f4df543aa46d4225625d097259d9216bcca8df...55c5a04b6b262e3923fed4b374deeff4a36497a8
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/26f4df543aa46d4225625d097259d9216bcca8df...55c5a04b6b262e3923fed4b374deeff4a36497a8
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]