Skip to content

Commit d1010ef

Browse files
committed
Updates
1 parent 14ebe6f commit d1010ef

File tree

2 files changed

+70
-37
lines changed
  • acceptance

2 files changed

+70
-37
lines changed

acceptance/README.md

Lines changed: 70 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ See [selftest](./selftest) for a toy test.
2525
To run the acceptance tests from a terminal on Windows (eg. Git Bash from VS Code),
2626
you need to install a few prerequisites and optionally make user policy changes.
2727

28+
These steps were verified to work with a Windows 11 VM running on Parallels.
29+
2830
### Install Chocolatey
2931

3032
Run "PowerShell" as administrator and follow the [Chocolatey installation instructions][choco].
@@ -41,14 +43,14 @@ PS C:\WINDOWS\system32> choco --version
4143

4244
Install the following tools:
4345
```pwsh
44-
choco install vscode
45-
choco install git
46-
choco install make
47-
choco install jq
48-
choco install python3
49-
choco install uv
50-
choco install go
51-
choco install nodejs
46+
choco install -y vscode
47+
choco install -y git
48+
choco install -y make
49+
choco install -y jq
50+
choco install -y python3
51+
choco install -y uv
52+
choco install -y go
53+
choco install -y nodejs
5254
```
5355

5456
### Shim for `python3.exe`
@@ -59,23 +61,57 @@ We rely on calling `python3` in acceptance tests (shebangs in scripts and elsewh
5961

6062
To install `python3` and `pip3` shims for the install, run PowerShell as administrator and execute the following:
6163
```pwsh
62-
# Find your current python.exe
63-
$py = (Get-Command python.exe).Source
64-
65-
# Create a python3.exe shim that points to it
66-
& "$env:ChocolateyInstall\tools\shimgen.exe" `
67-
--output "$env:ChocolateyInstall\bin\python3.exe" `
68-
--path $py
69-
70-
# Optional: pip3, too
71-
$pip = (Get-Command pip.exe).Source
72-
& "$env:ChocolateyInstall\tools\shimgen.exe" `
73-
--output "$env:ChocolateyInstall\bin\pip3.exe" `
74-
--path $pip
64+
# Refresh first to pick up Python 3 installed in the previous step.
65+
refreshenv
7566
67+
# Optional: python3, only if python.exe exists
68+
$python3Exists = $false
69+
try {
70+
$py = (Get-Command python.exe -ErrorAction Stop).Source
71+
$python3Exists = $true
72+
& "$env:ChocolateyInstall\tools\shimgen.exe" `
73+
--output "$env:ChocolateyInstall\bin\python3.exe" `
74+
--path $py
75+
} catch {
76+
Write-Host "python.exe not found, skipping python3 shim creation."
77+
}
78+
79+
# Optional: pip3, too, but only if pip.exe exists
80+
$pipExists = $false
81+
try {
82+
$pip = (Get-Command pip.exe -ErrorAction Stop).Source
83+
$pipExists = $true
84+
& "$env:ChocolateyInstall\tools\shimgen.exe" `
85+
--output "$env:ChocolateyInstall\bin\pip3.exe" `
86+
--path $pip
87+
} catch {
88+
Write-Host "pip.exe not found, skipping pip3 shim creation."
89+
}
90+
91+
# Refresh to pick up the shims.
7692
refreshenv
77-
python3 --version
78-
pip3 --version
93+
94+
# Check python3 version only if python3 shim was created
95+
if ($python3Exists) {
96+
try {
97+
python3 --version
98+
} catch {
99+
Write-Host "python3 not found or not working. Please check your installation."
100+
}
101+
} else {
102+
Write-Host "python3 not available."
103+
}
104+
105+
# Check pip3 version only if pip3 shim was created
106+
if ($pipExists) {
107+
try {
108+
pip3 --version
109+
} catch {
110+
Write-Host "pip3 not found or not working. Please check your installation."
111+
}
112+
} else {
113+
Write-Host "pip3 not available."
114+
}
79115
```
80116

81117
### Enable symlink creation
@@ -87,23 +123,25 @@ If you're not an administrator user, enable this by following these steps:
87123
* Go to Local Policies → User Rights Assignment.
88124
* Find "Create symbolic links".
89125
* Add your username to the list.
90-
* Sign out and back in.
126+
* Reboot.
91127

92128
### Enable long path support (up to ~32,767 characters)
93129

94130
Some acceptance tests fail if this is not enabled because their paths
95131
exceed the default maximum total length of 260 characters.
96132

97-
* Run "Edit group policy".
98-
* Go to Local Computer Policy → Computer Configuration → Administrative Templates → System → Filesystem → Enable Win32 long paths.
133+
* Press Win+R, type `gpedit.msc`, press Enter.
134+
* Go to Computer Configuration → Administrative Templates → System → Filesystem → Enable Win32 long paths.
99135
* Enable the setting.
100136
* Reboot.
101137

138+
### Disable Microsoft Defender
102139

140+
The tests frequently create and remove temporary directories.
141+
Sometimes, Microsoft Defender locks a file (such as an executable) during deletion,
142+
which can cause errors and test failures.
103143

104-
105-
⚠️ Last resort: Group Policy full disable
106-
107-
If you’re on Windows Pro/Enterprise, and you’ve disabled Tamper Protection, you can permanently disable Defender via Group Policy Editor (gpedit.msc) →
108-
Computer Configuration → Administrative Templates → Windows Components → Microsoft Defender Antivirus → Turn off Microsoft Defender Antivirus → Enabled.
109-
Reboot afterwards.
144+
* Press Win+R, type `gpedit.msc`, press Enter.
145+
* Go to Computer Configuration → Administrative Templates → Windows Components → Microsoft Defender Antivirus → Turn off Microsoft Defender Antivirus.
146+
* Enable the setting.
147+
* Reboot.

acceptance/bundle/templates/default-python/integration_classic/script

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ venv_activate
33
trace python -c 'import sys; print("%s.%s" % sys.version_info[:2])'
44
uv pip install -q setuptools
55

6-
# Note(@pietern): without installing hatchling directly,
7-
# this test fails with Python 3.13 on Windows.
8-
# I cannot reproduce with `-keeptmp` and then manually running `uv build --wheel`...
9-
uv pip install -q hatchling
10-
116
envsubst < input.json.tmpl > input.json
127
trace $CLI bundle init default-python --config-file ./input.json --output-dir .
138
rm input.json

0 commit comments

Comments
 (0)