]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2583] add LETTUCE_KEEP_OUTPUT options/env var
authorJelte Jansen <jelte@isc.org>
Fri, 22 Mar 2013 15:19:41 +0000 (16:19 +0100)
committerJelte Jansen <jelte@isc.org>
Fri, 22 Mar 2013 15:19:41 +0000 (16:19 +0100)
tests/lettuce/README
tests/lettuce/features/terrain/terrain.py

index 94bf82bb09cedf6596b7b7a5642d42b359118d56..a53c6e72089b294715ce1e9f31422964fab6ed12 100644 (file)
@@ -70,6 +70,11 @@ These files *will* be overwritten or deleted if the same scenarios are run
 again, so if you want to inspect them after a failed test, either do so
 immediately or move the files.
 
+If you want to keep these output files even for successful runs, you can
+specify the environment variable LETTUCE_KEEP_OUTPUT=1. The files will
+still be overwritten by subsequent runs, but they will not automatically be
+deleted.
+
 Adding and extending tests
 --------------------------
 
index bb9759440a1c4ad7fec1ab4c3655472c268ac82c..89bdbad743ea75fc1ed77e9abdd6e365ae2be9d9 100644 (file)
 
 from lettuce import *
 import subprocess
-import os.path
+import os
 import shutil
 import re
 import sys
 import time
 
+# lettuce cannot directly pass commands to the terrain, so we need to
+# use environment variables to influence behaviour
+KEEP_OUTPUT = 'LETTUCE_KEEP_OUTPUT'
+
 # In order to make sure we start all tests with a 'clean' environment,
 # We perform a number of initialization steps, like restoring configuration
 # files, and removing generated data files.
@@ -107,7 +111,7 @@ class RunningProcess:
         self.process = None
         self.step = step
         self.process_name = process_name
-        self.remove_files_on_exit = True
+        self.remove_files_on_exit = (os.environ.get(KEEP_OUTPUT) != '1')
         self._check_output_dir()
         self._create_filenames()
         self._start_process(args)