def test_gen_modules_executors():
    """
    Ensure gen_modules is called with the correct arguments #54429
    """
    mock_opts = salt.config.DEFAULT_MINION_OPTS.copy()
    io_loop = salt.ext.tornado.ioloop.IOLoop()
    io_loop.make_current()
    minion = salt.minion.Minion(mock_opts, io_loop=io_loop)

    class MockPillarCompiler:
        def compile_pillar(self):
            return {}

    try:
        with patch("salt.pillar.get_pillar", return_value=MockPillarCompiler()):
            with patch("salt.loader.executors") as execmock:
                minion.gen_modules()
        assert execmock.called_with(minion.opts, minion.functions)
    finally:
        minion.destroy()