Skip to content

Commit 1d8164d

Browse files
authored
Document prerequisites for running tests on Windows (#3701)
## Changes Document steps to make the acceptance tests pass on a fresh Windows VM. ## Why The test runners use a different edition from the one you can install with Parallels. Reproducing Windows-specific issues is easier interactively on a VM.
1 parent c3a2754 commit 1d8164d

File tree

4 files changed

+130
-3
lines changed

4 files changed

+130
-3
lines changed

acceptance/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,129 @@ For more complex tests one can also use:
1919
- custom output files: redirect output to custom file (it must start with `out`), e.g. `$CLI bundle validate > out.txt 2> out.error.txt`.
2020

2121
See [selftest](./selftest) for a toy test.
22+
23+
## Running acceptance tests on Windows
24+
25+
To run the acceptance tests from a terminal on Windows (eg. Git Bash from VS Code),
26+
you need to install a few prerequisites and optionally make user policy changes.
27+
28+
These steps were verified to work with a Windows 11 VM running on Parallels.
29+
30+
### Install Chocolatey
31+
32+
Run "PowerShell" as administrator and follow the [Chocolatey installation instructions][choco].
33+
34+
[choco]: https://chocolatey.org/install#individual
35+
36+
Confirm it is installed correctly:
37+
```pwsh
38+
PS C:\WINDOWS\system32> choco --version
39+
2.5.1
40+
```
41+
42+
### Tools
43+
44+
Install the following tools:
45+
```pwsh
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
54+
```
55+
56+
### Shim for `python3.exe`
57+
58+
The default Python installation only installs `python.exe` and not `python3.exe`.
59+
60+
We rely on calling `python3` in acceptance tests (shebangs in scripts and elsewhere).
61+
62+
To install `python3` and `pip3` shims for the install, run PowerShell as administrator and execute the following:
63+
```pwsh
64+
# Refresh first to pick up Python 3 installed in the previous step.
65+
refreshenv
66+
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.
92+
refreshenv
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+
}
115+
```
116+
117+
### Enable symlink creation
118+
119+
You need to be able to create symlinks.
120+
If you're not an administrator user, enable this by following these steps:
121+
122+
* Press Win+R, type `secpol.msc`, press Enter.
123+
* Go to Local Policies → User Rights Assignment.
124+
* Find "Create symbolic links".
125+
* Add your username to the list.
126+
* Reboot.
127+
128+
### Enable long path support (up to ~32,767 characters)
129+
130+
Some acceptance tests fail if this is not enabled because their paths
131+
exceed the default maximum total length of 260 characters.
132+
133+
* Press Win+R, type `gpedit.msc`, press Enter.
134+
* Go to Computer Configuration → Administrative Templates → System → Filesystem → Enable Win32 long paths.
135+
* Enable the setting.
136+
* Reboot.
137+
138+
### Disable Microsoft Defender
139+
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.
143+
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/artifacts/whl_dynamic/databricks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ artifacts:
22
my_test_code:
33
type: whl
44
path: "./my_test_code"
5-
# using 'python' there because 'python3' does not exist in virtualenv on windows
5+
# Use 'python' because 'python3' does not exist in Windows virtualenvs.
66
build: python setup.py bdist_wheel
77
dynamic_version: true
88
my_prebuilt_whl:

acceptance/bundle/artifacts/whl_explicit/databricks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ artifacts:
22
my_test_code:
33
type: whl
44
path: "./my_test_code"
5-
# using 'python' there because 'python3' does not exist in virtualenv on windows
5+
# Use 'python' because 'python3' does not exist in Windows virtualenvs.
66
build: python setup.py bdist_wheel
77

88
resources:

acceptance/bundle/telemetry/deploy-whl-artifacts/databricks.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ targets:
2323
test:
2424
type: whl
2525
path: ./my_test_code
26+
# Use 'python' because 'python3' does not exist in Windows virtualenvs.
27+
build: python setup.py bdist_wheel
2628
dynamic_version: true
27-
build: "python3 setup.py bdist_wheel"
2829
files:
2930
- source: "./my_test_code/dist/*.whl"

0 commit comments

Comments
 (0)