Skip to content

test_sysconfig fails when executed from within a venv #104097

@pganssle

Description

@pganssle

Bug report

As part of adding property-based tests to the standard library's test suite (#22863), I discovered that test_sysconfig apparently will fail when the test suite is executed from a virtual environment. To reproduce:

./python -m venv venv
venv/bin/python -m test -W test_sysconfig

The result:

0:00:00 load avg: 0.54 Run tests sequentially
0:00:00 load avg: 0.54 [1/1] test_sysconfig
test_get_makefile_filename (test.test_sysconfig.MakefileTests.test_get_makefile_filename) ... ok
test_parse_makefile (test.test_sysconfig.MakefileTests.test_parse_makefile) ... ok
test_EXT_SUFFIX_in_vars (test.test_sysconfig.TestSysConfig.test_EXT_SUFFIX_in_vars) ... ok
test_get_config_h_filename (test.test_sysconfig.TestSysConfig.test_get_config_h_filename) ... ok
test_get_config_vars (test.test_sysconfig.TestSysConfig.test_get_config_vars) ... ok
test_get_default_scheme (test.test_sysconfig.TestSysConfig.test_get_default_scheme) ... ok
test_get_path (test.test_sysconfig.TestSysConfig.test_get_path) ... ok
test_get_path_names (test.test_sysconfig.TestSysConfig.test_get_path_names) ... ok
test_get_paths (test.test_sysconfig.TestSysConfig.test_get_paths) ... ok
test_get_platform (test.test_sysconfig.TestSysConfig.test_get_platform) ... ok
test_get_preferred_schemes (test.test_sysconfig.TestSysConfig.test_get_preferred_schemes) ... ok
test_get_scheme_names (test.test_sysconfig.TestSysConfig.test_get_scheme_names) ... ok
test_ldshared_value (test.test_sysconfig.TestSysConfig.test_ldshared_value) ... ok
test_main (test.test_sysconfig.TestSysConfig.test_main) ... ok
test_nt_venv_scheme (test.test_sysconfig.TestSysConfig.test_nt_venv_scheme) ... FAIL
test_osx_ext_suffix (test.test_sysconfig.TestSysConfig.test_osx_ext_suffix) ... skipped 'OS X-specific test'
test_platform_in_subprocess (test.test_sysconfig.TestSysConfig.test_platform_in_subprocess) ... skipped 'test only relevant on MacOSX'
test_posix_venv_scheme (test.test_sysconfig.TestSysConfig.test_posix_venv_scheme) ... FAIL
test_srcdir (test.test_sysconfig.TestSysConfig.test_srcdir) ... ok
test_srcdir_independent_of_cwd (test.test_sysconfig.TestSysConfig.test_srcdir_independent_of_cwd) ... ok
test_symlink (test.test_sysconfig.TestSysConfig.test_symlink) ... ok
test_triplet_in_ext_suffix (test.test_sysconfig.TestSysConfig.test_triplet_in_ext_suffix) ... ok
test_user_similar (test.test_sysconfig.TestSysConfig.test_user_similar) ... ok
test_venv_scheme (test.test_sysconfig.TestSysConfig.test_venv_scheme) ... ok

======================================================================
FAIL: test_nt_venv_scheme (test.test_sysconfig.TestSysConfig.test_nt_venv_scheme)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../Lib/test/test_sysconfig.py", line 178, in test_nt_venv_scheme
    self.assertEqual(incpath, sysconfig.get_path('include', scheme='nt_venv'))
AssertionError: '.../venv/Include' != '/usr/local/Include'
- .../venv/Include
+ /usr/local/Include


======================================================================
FAIL: test_posix_venv_scheme (test.test_sysconfig.TestSysConfig.test_posix_venv_scheme)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../Lib/test/test_sysconfig.py", line 163, in test_posix_venv_scheme
    self.assertTrue(sysconfig_includedir.startswith(incpath + os.sep))
AssertionError: False is not true

----------------------------------------------------------------------
Ran 24 tests in 0.116s

FAILED (failures=2, skipped=2)
test test_sysconfig failed
test_sysconfig failed (2 failures)

== Tests result: FAILURE ==

1 test failed:
    test_sysconfig

Total duration: 174 ms
Tests result: FAILURE

Your environment

  • CPython versions tested on: main
  • Operating system and architecture: Linux (also happens on Ubuntu 20.04 in the CI environment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions