def METHOD_NAME(self, sp):
    def command_fail_raster(cmd, **kwargs):
        if 'raster2pgsql -a -M -t' in cmd:
            return 1
        return 0
    sp.side_effect = command_fail_raster
    filename = os.path.join(os.path.dirname(__file__), 'data', 'elevation.tif')
    with self.assertRaisesRegex(CommandError, 'Caught Exception: raster2pgsql failed with exit code 1'):
        call_command('loaddem', filename, '--replace', verbosity=0)