From 02f63d183d3334807b815dcf567d2d3ac167a541 Mon Sep 17 00:00:00 2001
From: Nicolas Essing <n.essing@fz-juelich.de>
Date: Wed, 23 Mar 2022 14:30:04 +0100
Subject: [PATCH] Corrected the python version in the KKRnano regression tests.

The run_test.sh script explicitly used python2.7, and the shebang
of the tests.py script was just python, which is normally also
python2, while the script was clearly a python3 script.

Also repalced the nonexistend ArgumentError with a ValueError.
---
 source/KKRnano/regtests/run_test.sh | 2 +-
 source/KKRnano/regtests/tests.py    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/KKRnano/regtests/run_test.sh b/source/KKRnano/regtests/run_test.sh
index 117c9a127..af7b9a6b7 100755
--- a/source/KKRnano/regtests/run_test.sh
+++ b/source/KKRnano/regtests/run_test.sh
@@ -10,7 +10,7 @@ day=`date "+%Y%m%d%H%M"`
 rm -f ./last
 
 ## run the test scripts
-nohup python2.7 ./tests.py < /dev/null > ${day}_tests.txt
+nohup python3 ./tests.py < /dev/null > ${day}_tests.txt
 
 ## clean the working directory
 ./clearfiles.sh 
diff --git a/source/KKRnano/regtests/tests.py b/source/KKRnano/regtests/tests.py
index ede4da137..92a9e5ce7 100755
--- a/source/KKRnano/regtests/tests.py
+++ b/source/KKRnano/regtests/tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 import unittest
 import subprocess
@@ -40,11 +40,11 @@ def get_energy(string):
           match = list(re.finditer(r"^.*TOTAL ENERGY in ryd. :(.*)$", string, re.M))[-1] # get last match only
     except:
           print(string)
-          raise ArgumentError
+          raise ValueError("Error getting energy from output")
     if match is not None:
           return float(match.group(1))
     else:
-          raise ArgumentError
+          raise ValueError("Error getting energy from output")
 
 def KKRnano(inputdir, nranks=DEFAULT_nranks, nthreads=DEFAULT_nthreads, solver=DEFAULT_solver, lmax=DEFAULT_lmax, Lly=DEFAULT_Lly, **kwargs):
     """Run KKR-calculation with input from 'inputdir' and returns the total energy"""
-- 
GitLab