From c0e8aaf6ea430cb35ddbda9e571a74f61f4c4024 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 26 Jun 2024 15:58:02 -0400 Subject: [PATCH 1/4] cherry pick and define EXPDIR --- src/wxflow/configuration.py | 4 +++- tests/test_configuration.py | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wxflow/configuration.py b/src/wxflow/configuration.py index 77cf009..0abf9b6 100644 --- a/src/wxflow/configuration.py +++ b/src/wxflow/configuration.py @@ -1,6 +1,7 @@ import glob import os import random +import shutil import subprocess from pathlib import Path from pprint import pprint @@ -107,8 +108,9 @@ def _get_shell_env(scripts: List) -> Dict[str, Any]: runme = ''.join([f'source {s} ; ' for s in scripts]) magic = f'--- ENVIRONMENT BEGIN {random.randint(0,64**5)} ---' runme += f'/bin/echo -n "{magic}" ; /usr/bin/env -0' + bash_path = shutil.which('bash') with open('/dev/null', 'w') as null: - env = subprocess.Popen(runme, shell=True, stdin=null.fileno(), + env = subprocess.Popen(runme, shell=True, executable=bash_path, stdin=null.fileno(), stdout=subprocess.PIPE) (out, err) = env.communicate() out = out.decode() diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 80ed966..dd9aa15 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -27,6 +27,7 @@ export SOME_BOOL4=NO export SOME_BOOL5=.false. export SOME_BOOL6=.F. +export EXPDIR="SOME_VALUE_FOR_EXPDIR" """ file1 = """#!/bin/bash @@ -144,7 +145,6 @@ def test_configuration_config_dir(tmp_path, create_configs): assert cfg.config_dir == tmp_path -@pytest.mark.skip(reason="fails in GH runner, passes on localhost") def test_configuration_config_files(tmp_path, create_configs): cfg = Configuration(tmp_path) config_files = [str(tmp_path / 'config.file0'), str(tmp_path / 'config.file1')] @@ -157,14 +157,12 @@ def test_find_config(tmp_path, create_configs): assert str(tmp_path / 'config.file0') == file0 -@pytest.mark.skip(reason="fails in GH runner, passes on localhost") def test_parse_config1(tmp_path, create_configs): cfg = Configuration(tmp_path) f0 = cfg.parse_config('config.file0') assert file0_dict == f0 -@pytest.mark.skip(reason="fails in GH runner, passes on localhost") def test_parse_config2(tmp_path, create_configs): cfg = Configuration(tmp_path) ff = cfg.parse_config(['config.file0', 'config.file1']) From bad1489352539be63767e53ea0336710eaf6db78 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 26 Jun 2024 16:01:43 -0400 Subject: [PATCH 2/4] add EXPDIR in the validation dict --- tests/test_configuration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index dd9aa15..23ba6b9 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -57,7 +57,8 @@ 'SOME_BOOL3': True, 'SOME_BOOL4': False, 'SOME_BOOL5': False, - 'SOME_BOOL6': False + 'SOME_BOOL6': False, + 'EXPDIR': "SOME_VALUE_FOR_EXPDIR" } file1_dict = { From bbe7ea829a89a6615a2b5acb27901d866d68484a Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 26 Jun 2024 16:04:03 -0400 Subject: [PATCH 3/4] define USER in the configuration test and watch it fail (maybe?) --- tests/test_configuration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 23ba6b9..0bb9364 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -28,6 +28,7 @@ export SOME_BOOL5=.false. export SOME_BOOL6=.F. export EXPDIR="SOME_VALUE_FOR_EXPDIR" +export USER="wxflowuser" """ file1 = """#!/bin/bash @@ -58,7 +59,8 @@ 'SOME_BOOL4': False, 'SOME_BOOL5': False, 'SOME_BOOL6': False, - 'EXPDIR': "SOME_VALUE_FOR_EXPDIR" + 'EXPDIR': "SOME_VALUE_FOR_EXPDIR", + 'USER': "wxflowuser" } file1_dict = { From 239773cf44f7e81ed2215d5d12e81e97930c2b0a Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Wed, 26 Jun 2024 16:05:47 -0400 Subject: [PATCH 4/4] remove EXPDIR and USER from the config tests --- tests/test_configuration.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 0bb9364..fefc4f9 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -27,8 +27,6 @@ export SOME_BOOL4=NO export SOME_BOOL5=.false. export SOME_BOOL6=.F. -export EXPDIR="SOME_VALUE_FOR_EXPDIR" -export USER="wxflowuser" """ file1 = """#!/bin/bash @@ -58,9 +56,7 @@ 'SOME_BOOL3': True, 'SOME_BOOL4': False, 'SOME_BOOL5': False, - 'SOME_BOOL6': False, - 'EXPDIR': "SOME_VALUE_FOR_EXPDIR", - 'USER': "wxflowuser" + 'SOME_BOOL6': False } file1_dict = {