class_docstr: Test venv module functionality.
class_docstr_tok: ["Test","venv","module","functionality","."]
docstr: Test creating environment in an existing directory.
docstr_tok: ["Test","creating","environment","in","an","existing","directory","."]
code: def test_overwrite_existing(self):
      """
      Test creating environment in an existing directory.
      """
      self.create_contents(self.ENV_SUBDIRS, "foo")
      venv.create(self.env_dir)
      for subdirs in self.ENV_SUBDIRS:
          fn = os.path.join(self.env_dir, *(subdirs + ("foo",)))
          self.assertTrue(os.path.exists(fn))
          with open(fn, "rb") as f:
              self.assertEqual(f.read(), b"Still here?")
  
      builder = venv.EnvBuilder(clear=True)
      builder.create(self.env_dir)
      for subdirs in self.ENV_SUBDIRS:
          fn = os.path.join(self.env_dir, *(subdirs + ("foo",)))
          self.assertFalse(os.path.exists(fn))
  
imports: import contextlib
  import ensurepip
  import os
  import os.path
  import pathlib
  import re
  import shutil
  import struct
  import subprocess
  import sys
  import sysconfig
  import tempfile
  from test.support import captured_stdout, captured_stderr, skip_if_broken_multiprocessing_synchronize, verbose, requires_subprocess, is_emscripten, is_wasi, requires_venv_with_pip, TEST_HOME_DIR, requires_resource, copy_python_src_ignore
  from test.support.os_helper import can_symlink, EnvironmentVarGuard, rmtree
  import unittest
  import venv
  from unittest.mock import patch, Mock
label_desc: Use image node_id 12 for calling the BasicTest obj's underlying member method code with example usage: obj.test_overwrite_existing() without return types