Skip to content

Commit

Permalink
Halleluja
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Nov 16, 2023
1 parent c1964c5 commit 90c55df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
5 changes: 1 addition & 4 deletions ipi_tests/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ def test_example(ex, verbose=False):
t0 = time.time()
nid = examples.index(ex)
runner = Runner_examples(Path("."))
print("Running example")
error_msg = runner.run(ex, nid)
print("Time for this example: {:4.1f} s \n".format(time.time() - t0))

if verbose:
print("ERROR ", error_msg)
if verbose:
return error_msg

if error_msg != None:
print("RAISING ERROR ", error_msg)
raise RuntimeError


Expand Down
31 changes: 17 additions & 14 deletions ipi_tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def run(self, cwd, nid):
try:
# Create temp file and copy files
self.tmp_dir = Path(tempfile.mkdtemp())
print("\nTest folder: {}".format(cwd))
print("\ntest folder: {}".format(cwd))
print("temp folder: {}".format(self.tmp_dir))

# files = os.listdir(self.parent / cwd)
Expand Down Expand Up @@ -340,26 +340,29 @@ def run(self, cwd, nid):

# print("client", client, "cmd:", cmd)
driver = sp.Popen(
cmd, cwd=(cwd), shell=True, stdin=sp.DEVNULL,
stdout=sp.PIPE, stderr=sp.PIPE,
cmd,
cwd=(cwd),
shell=True,
stdin=sp.DEVNULL,
stdout=sp.PIPE,
stderr=sp.PIPE,
)

drivers.append(driver)

# check i-pi errors
ipi_out, ipi_error = ipi.communicate(timeout=60)
assert ipi.returncode == 0, "i-PI error occurred: {}".format(ipi_error)

# check driver errors
for driver in drivers:
driver.kill()
driver.kill() # if i-PI has ended, we can kill the drivers
driver_out, driver_err = driver.communicate(timeout=60)
assert driver.returncode == 0, "Driver error occurred: {}".format(
driver_err
)

except sp.TimeoutExpired:

ipi.kill()
try:
ipi_out, ipi_error = ipi.communicate(timeout=2)
Expand All @@ -369,23 +372,23 @@ def run(self, cwd, nid):

drivers[0].kill()
try:
driver_out, driver_err = drivers[0].communicate(timeout=2)
driver_out, driver_err = drivers[0].communicate(timeout=2)
except:
driver_out, driver_err = "", "Could not get outputs from drivers"
pass

print("Timeout during {} test \

print(
"Timeout during {} test \
**** i-PI output **** \
stdout {} \
stderr {} \
**** driver output **** \
stdout {} \
stderr {} \
".format(
str(cwd),
ipi_out, ipi_error,
driver_out, driver_err
) )
str(cwd), ipi_out, ipi_error, driver_out, driver_err
)
)
raise

raise RuntimeError(
Expand Down

0 comments on commit 90c55df

Please sign in to comment.