def METHOD_NAME(envvar, meipass):
    orig_envvar = "{}_ORIG".format(envvar)
    with PatchedEnviron(**{orig_envvar: meipass}):
        original_env = dict(os.environ)
        assert orig_envvar in original_env
        instance = overrides.PyinstallerTerminal(
            [
                sys.executable,
                "-c",
                "import os, json; print(json.dumps(dict(os.environ)))",
            ],
            stream_stdout=False,
            stream_stderr=False,
        )
        buffer_o = buffer_e = ""
        while instance.has_unread_data:
            stdout, stderr = instance.recv()
            if stdout:
                buffer_o += stdout
            if stderr:
                buffer_e += stderr
        instance.terminate()
        assert instance.exitstatus == 0
        returned_env = json.loads(buffer_o)
        assert returned_env != original_env
        assert envvar in returned_env
        assert orig_envvar not in returned_env
        assert returned_env[envvar] == meipass