[Zodb-checkins] SVN: ZODB/branches/3.9/src/ZODB/scripts/manual_tests/testrepozo.py Make it possible to run this test from a buildout environment.

Chris Withers chris at simplistix.co.uk
Thu Nov 19 15:59:31 EST 2009


Log message for revision 105887:
  Make it possible to run this test from a buildout environment.

Changed:
  U   ZODB/branches/3.9/src/ZODB/scripts/manual_tests/testrepozo.py

-=-
Modified: ZODB/branches/3.9/src/ZODB/scripts/manual_tests/testrepozo.py
===================================================================
--- ZODB/branches/3.9/src/ZODB/scripts/manual_tests/testrepozo.py	2009-11-19 19:20:19 UTC (rev 105886)
+++ ZODB/branches/3.9/src/ZODB/scripts/manual_tests/testrepozo.py	2009-11-19 20:59:30 UTC (rev 105887)
@@ -19,6 +19,16 @@
 its home directory as the current directory.  It will destroy all files
 matching Data.* and Copy.* in this directory, and anything in a
 subdirectory of name 'backup'.
+
+Usage:
+
+python testrepozo.py [repozo_script]
+
+  repozo_script, if provided, is a path to a script that runs repozo,
+  such as that generated by buildout.
+
+eg:
+$ ../../../../bin/py testrepozo.py ../../../../bin/repozo
 """
 
 import os
@@ -32,8 +42,6 @@
 from ZODB import FileStorage
 import transaction
 
-PYTHON = sys.executable + ' '
-
 def cleanup():
     for fname in glob.glob('Data.*') + glob.glob('Copy.*'):
         os.remove(fname)
@@ -76,7 +84,7 @@
         extra = ''
     else:
         extra = ' -D ' + when
-    cmd = PYTHON + '../repozo.py -vRr backup -o Copy.fs' + extra
+    cmd = PYTHON + REPOZO + ' -vRr backup -o Copy.fs' + extra
     os.system(cmd)
     f = file(correctpath, 'rb')
     g = file('Copy.fs', 'rb')
@@ -122,9 +130,9 @@
 
         # Make an incremental backup, half the time with gzip (-z).
         if random.random() < 0.5:
-            os.system(PYTHON + '../repozo.py -vBQr backup -f Data.fs')
+            os.system(PYTHON + REPOZO + ' -vBQr backup -f Data.fs')
         else:
-            os.system(PYTHON + '../repozo.py -zvBQr backup -f Data.fs')
+            os.system(PYTHON + REPOZO + ' -zvBQr backup -f Data.fs')
 
         if i % 9 == 0:
             copytime = '%04d-%02d-%02d-%02d-%02d-%02d' % (time.gmtime()[:6])
@@ -148,4 +156,9 @@
     print 'Test passed!'
 
 if __name__ == '__main__':
+    PYTHON = sys.executable + ' '
+    if len(sys.argv)>1:
+        REPOZO = sys.argv[1]
+    else:
+        REPOZO = '../repozo.py'
     main()



More information about the Zodb-checkins mailing list