Skip to content

gh-92906: Enable test_cppext on Windows #92907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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()