Skip to content

Commit 0c011a8

Browse files
test: enable tests on Windows (#857)
* test: enable tests on Windows * use windows subdirectory for scripts * maybe fix for windows * fix working directory * use nox so test dependencies are installed * add 3.10 to system tests * disable system tests * add more goto errors * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 3eb6a17 commit 0c011a8

File tree

5 files changed

+88
-2
lines changed

5 files changed

+88
-2
lines changed

.kokoro/continuous/windows.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
build_file: "python-bigquery-dataframes/scripts/windows/build.bat"

.kokoro/presubmit/windows.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
build_file: "python-bigquery-dataframes/scripts/windows/build.bat"

noxfile.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
UNIT_TEST_EXTRAS: List[str] = []
6363
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
6464

65-
SYSTEM_TEST_PYTHON_VERSIONS = ["3.9", "3.12"]
65+
# 3.10 is needed for Windows tests.
66+
SYSTEM_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.12"]
6667
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
6768
"jinja2",
6869
"mock",
@@ -100,7 +101,8 @@
100101
"docfx",
101102
"unit",
102103
"unit_noextras",
103-
"system",
104+
"system-3.9",
105+
"system-3.12",
104106
"cover",
105107
]
106108

scripts/windows/build.bat

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@rem Copyright 2024 Google LLC
2+
@rem
3+
@rem Licensed under the Apache License, Version 2.0 (the "License");
4+
@rem you may not use this file except in compliance with the License.
5+
@rem You may obtain a copy of the License at
6+
@rem
7+
@rem http://www.apache.org/licenses/LICENSE-2.0
8+
@rem
9+
@rem Unless required by applicable law or agreed to in writing, software
10+
@rem distributed under the License is distributed on an "AS IS" BASIS,
11+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
@rem See the License for the specific language governing permissions and
13+
@rem limitations under the License.
14+
15+
:; Change directory to repo root.
16+
SET script_dir="%~dp0"
17+
cd "%~dp0"\..\..
18+
19+
echo "Listing available Python versions'
20+
py -0 || goto :error
21+
22+
py -3.10 -m pip install --upgrade pip || goto :error
23+
py -3.10 -m pip install --upgrade pip setuptools wheel || goto :error
24+
25+
echo "Building Wheel"
26+
py -3.10 -m pip wheel . --wheel-dir wheels || goto :error/
27+
28+
echo "Built wheel, now running tests."
29+
call "%script_dir%"/test.bat 3.10 || goto :error
30+
31+
echo "Windows build has completed successfully"
32+
33+
:; https://stackoverflow.com/a/46813196/101923
34+
:; exit 0
35+
exit /b 0
36+
37+
:error
38+
exit /b %errorlevel%

scripts/windows/test.bat

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@rem Copyright 2024 Google LLC
2+
@rem
3+
@rem Licensed under the Apache License, Version 2.0 (the "License");
4+
@rem you may not use this file except in compliance with the License.
5+
@rem You may obtain a copy of the License at
6+
@rem
7+
@rem http://www.apache.org/licenses/LICENSE-2.0
8+
@rem
9+
@rem Unless required by applicable law or agreed to in writing, software
10+
@rem distributed under the License is distributed on an "AS IS" BASIS,
11+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
@rem See the License for the specific language governing permissions and
13+
@rem limitations under the License.
14+
15+
@rem This test file runs for one Python version at a time, and is intended to
16+
@rem be called from within the build loop.
17+
18+
:; Change directory to repo root.
19+
SET script_dir="%~dp0"
20+
cd "%~dp0"\..\..
21+
22+
set PYTHON_VERSION=%1
23+
if "%PYTHON_VERSION%"=="" (
24+
echo "Python version was not provided, using Python 3.10"
25+
set PYTHON_VERSION=3.10
26+
)
27+
28+
py -%PYTHON_VERSION%-64 -m pip install nox || goto :error
29+
30+
py -%PYTHON_VERSION%-64 -m nox -s unit-"%PYTHON_VERSION%" || goto :error
31+
32+
:; TODO(b/358148440): enable system tests on windows
33+
:; py -%PYTHON_VERSION%-64 -m nox -s system-"%PYTHON_VERSION%" || goto :error
34+
35+
:; https://stackoverflow.com/a/46813196/101923
36+
:; exit 0
37+
exit /b 0
38+
39+
:error
40+
exit /b %errorlevel%

0 commit comments

Comments
 (0)