diff options
Diffstat (limited to 'tests/unit/misc/test_ipc.py')
-rw-r--r-- | tests/unit/misc/test_ipc.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index 95858f837..dd4a5cc40 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -198,6 +198,14 @@ class TestSocketName: socketname = ipc._get_socketname_windows(basedir) assert socketname == expected + def test_windows_broken_getpass(self, monkeypatch): + def _fake_username(): + raise ImportError + monkeypatch.setattr(ipc.getpass, 'getuser', _fake_username) + + with pytest.raises(ipc.Error, match='USERNAME'): + ipc._get_socketname_windows(basedir=None) + @pytest.mark.mac @pytest.mark.parametrize('basedir, expected', [ (None, 'i-{}'.format(md5('testusername'))), @@ -725,7 +733,7 @@ class TestSendOrListen: '', 'title: Error while connecting to running instance!', 'pre_text: ', - 'post_text: Maybe another instance is running but frozen?', + 'post_text: ', 'exception text: {}'.format(exc_msg), ] assert caplog.messages == ['\n'.join(error_msgs)] @@ -746,7 +754,7 @@ class TestSendOrListen: '', 'title: Error while connecting to running instance!', 'pre_text: ', - 'post_text: Maybe another instance is running but frozen?', + 'post_text: ', ('exception text: Error while listening to IPC server: Error ' 'string (error 4)'), ] |