# HG changeset patch
# User paugier <pierre.augier@univ-grenoble-alpes.fr>
# Date 1598451736 -7200
#      Wed Aug 26 16:22:16 2020 +0200
# Node ID 47dd0bb7d1b4c65eecc43d34d4d1e7e40123bf55
# Parent  7e0ab58ddab42df49f247676221eb175b6b4b1fa
Fix end_of_simul with FLUIDDYN_PATH_SCRATCH + define this variable for the CI

diff --git a/fluidsim/base/output/base.py b/fluidsim/base/output/base.py
--- a/fluidsim/base/output/base.py
+++ b/fluidsim/base/output/base.py
@@ -578,9 +578,11 @@
                         self.__dict__[k]._close_file()
 
     def end_of_simul(self, total_time):
+        # self.path_run: str
+        path_run = Path(self.path_run)
         self.print_stdout(
             f"Computation completed in {total_time:8.6g} s\n"
-            "path_run =\n" + self.path_run
+            f"path_run =\n{path_run}"
         )
         if self._has_to_save:
             if hasattr(self.sim, "forcing"):
@@ -599,17 +601,17 @@
             new_path_run = path_base / self.sim.name_run
 
             try:
-                if new_path_run.parent.samefile(Path(self.path_run).parent):
+                if new_path_run.parent.samefile(path_run.parent):
                     return
             except OSError:
                 pass
 
-            if mpi.rank == 0:
+            if mpi.rank == 0 and path_run.exists():
                 if not path_base.exists():
                     os.makedirs(path_base)
 
                 shutil.move(self.path_run, path_base)
-                print("move result directory in directory:\n" + new_path_run)
+                print(f"move result directory in directory:\n{new_path_run}")
 
             self.path_run = str(new_path_run)
             for spec_output in list(self.__dict__.values()):
diff --git a/tox.ini b/tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -17,6 +17,9 @@
 
 [testenv]
 passenv = SKIP_SHTNS
+setenv =
+    FLUIDSIM_PATH = {toxinidir}/fluidsim_path
+    FLUIDDYN_PATH_SCRATCH = {toxinidir}/scratch
 sitepackages = True
 whitelist_externals = make
 usedevelop = True