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

Use shell=True for linux compat tests to fix feedstock runs #1931

Open
wants to merge 2 commits into
base: 4.5.1rc
Choose a base branch
from
Open
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
16 changes: 11 additions & 5 deletions python/tests/compat/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ def is_running_on_windows():

def run_shell_command(command : List[Union[str, os.PathLike]], cwd : Optional[os.PathLike] = None) -> subprocess.CompletedProcess:
logger.info(f"Executing command: {command}")
# shell=True is required for running the correct python executable on Windows
result = subprocess.run(command, cwd=cwd, capture_output=True, shell=is_running_on_windows())
result = None
if is_running_on_windows():
# shell=True is required for running the correct python executable on Windows
result = subprocess.run(command, cwd=cwd, capture_output=True, shell=True)
else:
# On linux we need shell=True for conda feedstock runners (because otherwise they fail to expand path variables)
# But to correctly work with shell=True we need a single command string.
command_string = ' '.join(command)
result = subprocess.run(command_string, cwd=cwd, capture_output=True, shell=True, stdin=subprocess.DEVNULL)
if result.returncode != 0:
logger.warning(f"Command failed, stdout: {str(result.stdout)}, stderr: {str(result.stderr)}")
return result
Expand Down Expand Up @@ -146,9 +153,8 @@ def assert_read(self, sym : str, df) -> None:
def old_venv(request):
version = request.param
path = os.path.join("venvs", version)
# The requirements_file needs to be relative to the [path] we use for the venv.
# Absolute paths break some Azure CI runners on conda forge
requirements_file = os.path.join("..", "..", "tests", "compat", f"requirements-{version}.txt")
compat_dir = os.path.dirname(os.path.abspath(__file__))
requirements_file = os.path.join(compat_dir, f"requirements-{version}.txt")
with Venv(path, requirements_file, version) as old_venv:
yield old_venv

Expand Down
Loading