(self, setgroups)
| 922 | |
| 923 | @patch('os.setgroups', create=True) |
| 924 | def test_setgroups_hack_OSError(self, setgroups): |
| 925 | exc = OSError() |
| 926 | exc.errno = errno.EINVAL |
| 927 | |
| 928 | def on_setgroups(groups): |
| 929 | if len(groups) <= 200: |
| 930 | setgroups.return_value = True |
| 931 | return |
| 932 | raise exc |
| 933 | |
| 934 | setgroups.side_effect = on_setgroups |
| 935 | |
| 936 | _setgroups_hack(list(range(400))) |
| 937 | |
| 938 | setgroups.side_effect = exc |
| 939 | with pytest.raises(OSError): |
| 940 | _setgroups_hack(list(range(400))) |
| 941 | |
| 942 | exc2 = OSError() |
| 943 | exc.errno = errno.ESRCH |
| 944 | setgroups.side_effect = exc2 |
| 945 | with pytest.raises(OSError): |
| 946 | _setgroups_hack(list(range(400))) |
| 947 | |
| 948 | @t.skip.if_win32 |
| 949 | @patch('celery.platforms._setgroups_hack') |
nothing calls this directly
no test coverage detected