Skip to content

Commit

Permalink
cherry pick and define EXPDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Jun 26, 2024
1 parent 5dad7dd commit c0e8aaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/wxflow/configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
import os
import random
import shutil
import subprocess
from pathlib import Path
from pprint import pprint
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')]
Expand All @@ -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'])
Expand Down

0 comments on commit c0e8aaf

Please sign in to comment.