class_docstr: Test venv module functionality.
class_docstr_tok: ["Test","venv","module","functionality","."]
docstr: Test that the sysconfig functions work in a virtual environment.
docstr_tok: ["Test","that","the","sysconfig","functions","work","in","a","virtual","environment","."]
code: def test_sysconfig(self):
      """
      Test that the sysconfig functions work in a virtual environment.
      """
      rmtree(self.env_dir)
      self.run_with_capture(venv.create, self.env_dir, symlinks=False)
      cmd = [self.envpy(), "-c", None]
      for call, expected in (
          # installation scheme
          ('get_preferred_scheme("prefix")', "venv"),
          ("get_default_scheme()", "venv"),
          # build environment
          ("is_python_build()", str(sysconfig.is_python_build())),
          (
              "get_makefile_filename()",
              sysconfig.get_makefile_filename(),
          ),
          (
              "get_config_h_filename()",
              sysconfig.get_config_h_filename(),
          ),
      ):
          with self.subTest(call):
              cmd[2] = "import sysconfig; print(sysconfig.%s)" % call
              out, err = check_output(cmd, encoding="utf-8")
              self.assertEqual(out.strip(), expected, err)
      for attr, expected in (
          ("executable", self.envpy()),
          # Usually compare to sys.executable, but if we're running in our own
          # venv then we really need to compare to our base executable
          ("_base_executable", sys._base_executable),
      ):
          with self.subTest(attr):
              cmd[2] = f"import sys; print(sys.{attr})"
              out, err = check_output(cmd, encoding="utf-8")
              self.assertEqual(out.strip(), expected, err)
  
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 9 for calling the BasicTest obj's underlying member method code with example usage: obj.test_sysconfig() without return types