- os.environ.pop('MPD_HOST', None)
- os.environ.pop('MPD_PORT', None)
- client = musicpd.MPDClient()
- self.assertEqual(client.host, 'localhost')
- self.assertEqual(client.port, '6600')
+ # mock "os.path.exists" here to ensure there are no socket in
+ # XDG_RUNTIME_DIR/mpd or /run/mpd since with test defaults fallbacks
+ # when :
+ # * neither MPD_HOST nor XDG_RUNTIME_DIR are not set
+ # * /run/mpd does not expose a socket
+ with mock.patch('os.path.exists', return_value=False):
+ os.environ.pop('MPD_HOST', None)
+ os.environ.pop('MPD_PORT', None)
+ client = musicpd.MPDClient()
+ self.assertEqual(client.host, 'localhost')
+ self.assertEqual(client.port, '6600')