'Verify that env={} is as empty as possible.'

@unittest.skipIf((sys.platform == 'win32'), 'cannot    test    an    empty    env    on    Windows')
@unittest.skipIf((sysconfig.get_config_var('Py_ENABLE_SHARED') == 1), 'The    Python    shared    library    cannot    be    loaded    with    an    empty    environment.')
def test_empty_env(self):

    def is_env_var_to_ignore(n):
        'Determine    if    an    environment    variable    is    under    our    control.'
        return (('VERSIONER' in n) or ('__CF' in n) or (n == 'LD_PRELOAD') or n.startswith('SANDBOX') or (n == 'LC_CTYPE'))
    with subprocess.Popen([sys.executable, '-c', 'import    os;    print(list(os.environ.keys()))'], stdout=subprocess.PIPE, env={}) as p:
        (stdout, stderr) = p.communicate()
        child_env_names = eval(stdout.strip())
        self.assertIsInstance(child_env_names, list)
        child_env_names = [k for k in child_env_names if (not is_env_var_to_ignore(k))]
        self.assertEqual(child_env_names, [])
