Skip to content
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

fix: Change the TEMP folder for Gradle tests to home for Windows #690

Merged
merged 1 commit into from
Oct 10, 2024
Merged
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
14 changes: 13 additions & 1 deletion tests/integration/workflows/java_gradle/test_java_gradle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import shutil
import tempfile
import platform

from unittest import TestCase
from pathlib import Path
Expand Down Expand Up @@ -36,7 +37,18 @@ class TestJavaGradle(TestCase):

def setUp(self):
self.artifacts_dir = tempfile.mkdtemp()
self.scratch_dir = tempfile.mkdtemp()

scratch_folder_override = None
if platform.system().lower() == "windows" and os.getenv("GITHUB_ACTIONS"):
# lucashuy: there is some really odd behaviour where
# gradle will refuse to work it is run within
# the default TEMP folder location in Github Actions
#
# use the runner's home directory as a workaround
scratch_folder_override = os.getenv("userprofile")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create another folder under userprofile so that test files won't clash with each other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to, the tempfile library creates unique folder names each time that shouldn't clash with anything in the existing directory. We'll probably want to create a subfolder if this was a normal test, for a normal user just to keep things nice and tidy. But since this is the CI runner, I'm sure the runner won't mind


self.scratch_dir = tempfile.mkdtemp(dir=scratch_folder_override)

self.dependencies_dir = tempfile.mkdtemp()
self.builder = LambdaBuilder(language="java", dependency_manager="gradle", application_framework=None)

Expand Down
Loading