Skip to content

Commit

Permalink
Fix integration tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Aug 5, 2023
1 parent 4910b84 commit d337641
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions product/gradle-plugin/src/test/integration/test_gradle_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,22 @@
with open(f"{product_dir}/local.properties") as props_file:
product_props = PropertiesFile.load(props_file)

DEFAULT_PYTHON_VERSION = "3.8"

def run_build_python(args, **kwargs):
for k, v in dict(check=True, capture_output=True, text=True).items():
kwargs.setdefault(k, v)
if os.name == "nt":
build_python = ["py", "-" + DEFAULT_PYTHON_VERSION]
else:
build_python = ["python" + DEFAULT_PYTHON_VERSION]
return run(build_python + args, **kwargs)

def list_versions(mode):
return run([f"{repo_root}/target/list-versions.py", f"--{mode}"],
check=True, capture_output=True, text=True).stdout.strip()
return (run_build_python([f"{repo_root}/target/list-versions.py", f"--{mode}"])
.stdout.strip())

DEFAULT_PYTHON_VERSION = list_versions("default")
assert DEFAULT_PYTHON_VERSION == "3.8"
assert list_versions("default") == DEFAULT_PYTHON_VERSION

PYTHON_VERSIONS = {}
for full_version in list_versions("micro").splitlines():
Expand All @@ -51,15 +61,6 @@ def list_versions(mode):
NON_DEFAULT_PYTHON_VERSION = "3.10"
assert NON_DEFAULT_PYTHON_VERSION != DEFAULT_PYTHON_VERSION

def run_build_python(args, **kwargs):
for k, v in dict(check=True, capture_output=True, text=True).items():
kwargs.setdefault(k, v)
if os.name == "nt":
build_python = ["py", "-" + DEFAULT_PYTHON_VERSION]
else:
build_python = ["python" + DEFAULT_PYTHON_VERSION]
return run(build_python + args, **kwargs)

BUILD_PYTHON_VERSION_FULL = (run_build_python(["--version"]).stdout # e.g. "Python 3.7.1"
.split()[1])
BUILD_PYTHON_VERSION = BUILD_PYTHON_VERSION_FULL.rpartition(".")[0]
Expand Down

0 comments on commit d337641

Please sign in to comment.