diff --git a/.gitignore b/.gitignore index d1f2edb..ad982ef 100644 --- a/.gitignore +++ b/.gitignore @@ -172,4 +172,7 @@ dmypy.json doc/ # testmodels -testmodels/ \ No newline at end of file +testmodels/ + +# modified .powrconfig +powr/.powrconfig \ No newline at end of file diff --git a/powr/powrconfig b/powr/powrconfig index be740ef..eddb981 100644 --- a/powr/powrconfig +++ b/powr/powrconfig @@ -1,7 +1,7 @@ # bash style for the PoWR scripts # define the powr work directory -# export POWR_WORK=powr/ +export POWR_WORK= export POWR_INSTTYPE=local # export POWR_INSTTYPE=potsdam # export POWR_INSTTYPE=niscluster diff --git a/powr/proc.dir/makechain.com b/powr/proc.dir/makechain.com index c7f3330..4bc8944 100755 --- a/powr/proc.dir/makechain.com +++ b/powr/proc.dir/makechain.com @@ -1,6 +1,6 @@ #!/bin/bash -# source ~/.powrconfig || exit +source ~/.powrconfig || exit # this script generates a new chain for PoWR with number "kn" given via call # created by H. Todt 05.03.2008 diff --git a/powr/proc.dir/submit.com b/powr/proc.dir/submit.com index c1e83f6..01da10d 100755 --- a/powr/proc.dir/submit.com +++ b/powr/proc.dir/submit.com @@ -1,6 +1,6 @@ #!/bin/bash -# source ~/.powrconfig || exit +source ~/.powrconfig || exit #################################################################### # diff --git a/powr/wrdata-archive/G2_BIG_VD100_FeXVI-K2015-parity.mS b/powr/wrdata-archive/G2_BIG_VD100_FeXVI-K2015-parity.mS new file mode 100644 index 0000000..31490e8 Binary files /dev/null and b/powr/wrdata-archive/G2_BIG_VD100_FeXVI-K2015-parity.mS differ diff --git a/test/conftest.py b/test/conftest.py index bd63248..72a2d59 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -11,31 +11,31 @@ def set_vars(): powrdir = filedir.parents[0] / "powr" os.environ["POWR_WORK"] = powrdir.as_posix() os.environ["POWREXEPATH"] = (powrdir / "exe.dir").as_posix() + # create the tmp_2day folder if not exists + tmp_2day = powrdir / "tmp_2day" + if not os.path.exists(tmp_2day): + os.mkdir(tmp_2day) return powrdir +# inject path into powrconfig @pytest.fixture(scope="session") -def set_aliases(set_vars): - setup_file = "bash_setup" # this could be different on MacOS - # the aliases setup currently does not work as the aliases - # are destryed between subprocess sessions - # either we set them in the python script or - # run explicitly with passing the env as dict - full_file_path = "${POWR_WORK}/proc.dir/" + setup_file - subprocess.run( - full_file_path, - shell=True, - check=True, - executable="/bin/bash", - capture_output=True, - text=True, - ) +def inject_path(set_vars): + powrconfig_file = set_vars / "powrconfig" + with open(powrconfig_file, "r") as f: + powrconfig = f.read() + # now insert path in correct spot + temp = powrconfig.split("export POWR_WORK=") + powrconfig = temp[0] + "export POWR_WORK=" + set_vars.as_posix() + temp[1] + powrconfig_file = set_vars / ".powrconfig" + with open(powrconfig_file, "w") as f: + f.write(powrconfig) @pytest.fixture(scope="session") -def get_chain(set_aliases): +def get_chain(inject_path): makechain_command = "${POWR_WORK}/proc.dir/makechain.com 1" - subprocess.run( + temp = subprocess.run( makechain_command, shell=True, check=True, @@ -43,6 +43,8 @@ def get_chain(set_aliases): capture_output=True, text=True, ) + print(temp.stdout) + print(temp.stderr) yield "Created chain 1" # teardown directories # we need access to ${POWR_WORK} so shutil will not work diff --git a/test/test_colitest.py b/test/test_colitest.py index 6c9794f..668649d 100644 --- a/test/test_colitest.py +++ b/test/test_colitest.py @@ -38,6 +38,7 @@ def run_colitest(get_chain): os.system("cat ${POWR_WORK}/output/colitest1.cpr") yield "ran colitest" os.system("rm -rf ${POWR_WORK}/tmp_data") + os.system("rm -rf ${POWR_WORK}/tmp_2day/*") return "Cleaned colitest tmp data" @@ -69,6 +70,8 @@ def test_makechain(set_vars, get_chain): wrdata1_content = [ "CARDS", "DATOM", + "FEDAT", + "FEDAT_FORMAL", "FGRID", "FORMAL_CARDS", "MODEL", @@ -136,5 +139,5 @@ def test_colitest_run(set_vars, run_colitest): def test_read_model(set_vars, run_colitest): model_output = set_vars / "wrdata1" / "MODEL_STUDY_DONE" data_np = np.fromfile(model_output, dtype=float) - assert len(data_np) == 2233856 + assert len(data_np) == 2246784 assert np.allclose(data_np[256138:256149], MODEL_DATA_REF)