Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Lib/test/test_cppext.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

@support.requires_subprocess()
class TestCPPExt(unittest.TestCase):
# With MSVC, the linker fails with: cannot open file 'python311.lib'
# https://github.com/python/cpython/pull/32175#issuecomment-1111175897
@unittest.skipIf(MS_WINDOWS, 'test fails on Windows')
# the test uses venv+pip: skip if it's not available
@support.requires_venv_with_pip()
def test_build(self):
# Build in a temporary directory
with os_helper.temp_cwd():
with os_helper.temp_cwd(), os_helper.EnvironmentVarGuard() as env:
# Recent setuptools versions have a bug that prevents being
# used to compile from a source build virtual environment.
# [BUG](https://github.com/pypa/setuptools/issues/3325)
# The stdlib distutils does not have this problem.
env['SETUPTOOLS_USE_DISTUTILS'] = 'stdlib'
self._test_build()

def _test_build(self):
Expand All @@ -37,9 +39,7 @@ def _test_build(self):
subprocess.run(cmd, check=True)

# Get the Python executable of the venv
python_exe = 'python'
if sys.executable.endswith('.exe'):
python_exe += '.exe'
python_exe = os.path.basename(sys.executable)
if MS_WINDOWS:
python = os.path.join(venv_dir, 'Scripts', python_exe)
else:
Expand All @@ -56,7 +56,8 @@ def _test_build(self):
if proc.returncode:
print(proc.stdout, end='')
self.fail(f"Build failed with exit code {proc.returncode}")

elif support.verbose:
print(proc.stdout, end='')

if __name__ == "__main__":
unittest.main()