[mnet-devel] patch: use twisted.trial for unit tests
zooko at zooko.com
zooko at zooko.com
Sun Apr 18 21:06:47 BST 2004
This is a merge of Warner's "trialification" patch (to be found in
branch_twisted) against current HEAD.
One thing it lacks is to make "setup.py test" invoke trial instead of invoking
unittest.
-------------- next part --------------
Index: setup.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/setup.py,v
retrieving revision 1.73
diff -p -u -r1.73 setup.py
--- setup.py 18 Apr 2004 18:18:36 -0000 1.73
+++ setup.py 18 Apr 2004 20:05:16 -0000
@@ -468,7 +468,7 @@ class test(distutils.core.Command):
self.build_platlib = build.build_platlib
def run(self):
- import unittest
+ from twisted.trial import unittest
# self.run_command('build')
old_path = sys.path[:]
Index: egtp/test/test_canon.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_canon.py,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 test_canon.py
--- egtp/test/test_canon.py 29 Mar 2003 18:28:43 -0000 1.1.1.1
+++ egtp/test/test_canon.py 18 Apr 2004 20:05:16 -0000
@@ -4,9 +4,9 @@ test_canon.py
"""
__author__ = 'EGFABT'
-__revision__ = "$Id: test_canon.py,v 1.1.1.1 2003/03/29 18:28:43 myers_carpenter Exp $"
+__revision__ = "$Id: test_canon.py,v 1.1.1.1.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp import canon
@@ -75,16 +75,3 @@ class SampleTestCase(unittest.TestCase):
str = ''
assert canon._canon(str, 2) == '\000\000'
-
-
-
-def suite():
- suite = unittest.makeSuite(SampleTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_datatypes.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_datatypes.py,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 test_datatypes.py
--- egtp/test/test_datatypes.py 29 Mar 2003 18:28:43 -0000 1.1.1.1
+++ egtp/test/test_datatypes.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_datatypes.py,v 1.1.1.1 2003/03/29 18:28:43 myers_carpenter Exp $"
+__revision__ = "$Id: test_datatypes.py,v 1.1.1.1.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp.DataTypes import *
@@ -193,13 +193,3 @@ class DataTypesTestCase(unittest.TestCas
pass
else:
self.fail()
-def suite():
- suite = unittest.makeSuite(DataTypesTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_hashrandom.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_hashrandom.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_hashrandom.py
--- egtp/test/test_hashrandom.py 30 Mar 2003 15:13:35 -0000 1.2
+++ egtp/test/test_hashrandom.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_hashrandom.py,v 1.2 2003/03/30 15:13:35 myers_carpenter Exp $"
+__revision__ = "$Id: test_hashrandom.py,v 1.2.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp import hashrandom
@@ -31,14 +31,3 @@ class HashRandomTestCase(unittest.TestCa
leng = (((ord(randsource.get(1)) * i * 3) + ord(randsource.get(1))) / 32) + 8
result = r.get(leng)
assert len(result) == leng
-
-def suite():
- suite = unittest.makeSuite(HashRandomTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_idlib.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_idlib.py,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 test_idlib.py
--- egtp/test/test_idlib.py 29 Mar 2003 18:28:43 -0000 1.1.1.1
+++ egtp/test/test_idlib.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_idlib.py,v 1.1.1.1 2003/03/29 18:28:43 myers_carpenter Exp $"
+__revision__ = "$Id: test_idlib.py,v 1.1.1.1.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp import idlib
@@ -14,16 +14,3 @@ class IdlibTestCase(unittest.TestCase):
def testToMojosixbitIsIdempotent(self):
i = idlib.new_random_uniq()
assert idlib.to_mojosixbit(i) == idlib.to_mojosixbit(idlib.to_mojosixbit(i))
-
-
-
-def suite():
- suite = unittest.makeSuite(IdlibTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_keyutils.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_keyutils.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_keyutils.py
--- egtp/test/test_keyutils.py 30 Mar 2003 15:13:35 -0000 1.2
+++ egtp/test/test_keyutils.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_keyutils.py,v 1.2 2003/03/30 15:13:35 myers_carpenter Exp $"
+__revision__ = "$Id: test_keyutils.py,v 1.2.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from evilcrypto import randsource, modval
@@ -187,14 +187,3 @@ _sample_withdrawal_reply_message_edict={
# sample 3DES secret key message in canonical form
_sample_3DES_secret_key_message='(4:dict(6:string6:header)(4:dict(6:string12:message type)(6:string3:key)(6:string8:protocol)(6:string10:Mojo v0.94))(6:string3:key)(4:dict(6:string10:key header)(4:dict(6:string12:cryptosystem)(6:string43:Triple DES, Encrypt-Decrypt-Encrypt, 3 Keys)(6:string4:type)(6:string13:shared secret)(6:string5:usage)(6:string28:only for encrypting sessions))(6:string10:key values)(4:dict(6:string17:shared secret key)(6:string192:SHARED_SECRET_KEY_BITS..........................................................................................................................................................................))))'
-
-def suite():
- suite = unittest.makeSuite(KeyUtilTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_loggedthreading.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_loggedthreading.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_loggedthreading.py
--- egtp/test/test_loggedthreading.py 5 Apr 2003 20:01:45 -0000 1.2
+++ egtp/test/test_loggedthreading.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'zooko'
-__revision__ = "$Id: test_loggedthreading.py,v 1.2 2003/04/05 20:01:45 tschechow Exp $"
+__revision__ = "$Id: test_loggedthreading.py,v 1.2.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp.loggedthreading import *
@@ -25,14 +25,3 @@ class LoggedThreadingTestCase(unittest.T
import time
time.sleep(1)
self.failUnless(self.flag == 1)
-
-def suite():
- suite = unittest.makeSuite(LoggedThreadingTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_mencode.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_mencode.py,v
retrieving revision 1.4
diff -p -u -r1.4 test_mencode.py
--- egtp/test/test_mencode.py 19 Oct 2003 16:57:34 -0000 1.4
+++ egtp/test/test_mencode.py 18 Apr 2004 20:05:16 -0000
@@ -6,15 +6,14 @@
# GNU Lesser General Public License v2.1.
# See the file COPYING or visit http://www.gnu.org/ for details.
-__revision__ = "$Id: test_mencode.py,v 1.4 2003/10/19 16:57:34 zooko Exp $"
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-# Python standard library modules
-import operator, random, traceback, unittest
+import operator, random, traceback
+from twisted.trial import unittest
-# pyutil modules
from pyutil import memutil
-# EGTP modules
from egtp.mencode import *
from pyutil import humanreadable
@@ -268,11 +267,11 @@ class MencodeTestCase(unittest.TestCase)
def _help_test_no_byte_leakage(self, f):
# measure one and throw it away, in order to reach a "steady state" in terms of initialization of memory state.
- memutil.measure_mem_leakage(f, 2**3, iterspersample=2**3)
- slope = memutil.measure_mem_leakage(f, 2**3, iterspersample=2**3)
+ memutil.measure_mem_leakage(f, 2**3, iterspersample=2**2)
+ slope = memutil.measure_mem_leakage(f, 2**3, iterspersample=2**2)
# print "slope: ", slope
- MIN_SLOPE = 256.0 # If it leaks less than 256.0 bytes per iteration, then it's probably just some kind of noise from the interpreter or something...
+ MIN_SLOPE = 512.0 # If it leaks less than 512.0 bytes per iteration, then it's probably just some kind of noise from the interpreter or something...
# MIN_SLOPE is high because samples is low, which is because doing statistically useful numbers of samples take too long.
# For a *good* test, turn samples up as high as you can stand (maybe 2**8 for both invocations of measure_mem_leakage()) and set MIN_SLOPE to about 1.0.
# For a *really* good test, add a variance measure to memutil.measure_mem_leakage(), and only consider it to be leaking if the slope is > 1.0 *and* is a "pretty good" fit for the data.
@@ -281,8 +280,10 @@ class MencodeTestCase(unittest.TestCase)
def _help_test_no_obj_leakage(self, f):
# measure one and throw it away, in order to reach a "steady state" in terms of initialization of memory state.
- memutil.measure_obj_leakage(f, 2**3, iterspersample=2**3)
- slope = memutil.measure_obj_leakage(f, 2**3, iterspersample=2**3)
+ memutil.measure_obj_leakage(f, 2**1, iterspersample=2**1)
+ slope = memutil.measure_obj_leakage(f, 2**1, iterspersample=2**1)
+ # These numbers turned down to "2**1" because this test takes too long.
+ # For a *good* test, turn all these constants up to about 2**8.
# print "slope: ", slope
MIN_SLOPE = 0.0000
@@ -427,12 +428,3 @@ def _real_test_encode_string_implementat
o.seek(0)
t2 = time.time()
print 'done testing C impl of encode_string. total encoding time: %3.3f' % (t2 - t1,)
-
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(MencodeTestCase, 'test'))
-
- return suite
-
-if __name__ == '__main__':
- unittest.main()
Index: egtp/test/test_mesgen.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_mesgen.py,v
retrieving revision 1.5
diff -p -u -r1.5 test_mesgen.py
--- egtp/test/test_mesgen.py 25 May 2003 18:07:06 -0000 1.5
+++ egtp/test/test_mesgen.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,10 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_mesgen.py,v 1.5 2003/05/25 18:07:06 zooko Exp $"
+__revision__ = "$Id: test_mesgen.py,v 1.5.4.2 2003/10/13 20:29:31 zooko Exp $"
-import unittest, tempfile, os, shutil, time
+import tempfile, os, shutil, time
+from twisted.trial import unittest
from pyutil import DoQ
@@ -14,8 +15,11 @@ from egtp import idlib
class MesgenTestCase(unittest.TestCase):
def setUp(self):
self.testdir = tempfile.mktemp('egtp_test_mesgen')
+ DoQ.doq = DoQ.DoQ()
def tearDown(self):
+ DoQ.doq.shutdown_and_block_until_finished()
+ DoQ.doq = None
if os.path.isdir(self.testdir):
shutil.rmtree(self.testdir)
@@ -28,6 +32,9 @@ class MesgenTestCase(unittest.TestCase):
return mesgen.load_MessageMaker(dir)
def test_normal_operation(self):
+ DoQ.doq.do(self._test_normal_operation)
+
+ def _test_normal_operation(self):
mesgen1 = self._createMessageMaker()
mesgen2 = self._createMessageMaker()
id1 = mesgen1.get_id()
@@ -55,6 +62,9 @@ class MesgenTestCase(unittest.TestCase):
assert len(m2a) < len(m2)
def test_normal_operation_with_reconstructionself(self):
+ DoQ.doq.do(self._test_normal_operation_with_reconstructionself)
+
+ def _test_normal_operation_with_reconstructionself(self):
mesgen1 = self._createMessageMaker()
mesgen2 = self._createMessageMaker()
id1 = mesgen1.get_id()
@@ -103,6 +113,9 @@ class MesgenTestCase(unittest.TestCase):
assert len(m2a) == len(m2)
def test_interlock(self):
+ DoQ.doq.do(self._test_interlock)
+
+ def _test_interlock(self):
mesgen1 = self._createMessageMaker()
mesgen2 = self._createMessageMaker()
id1 = mesgen1.get_id()
@@ -121,6 +134,9 @@ class MesgenTestCase(unittest.TestCase):
assert message == 'spam2'
def test_SendSelf(self):
+ DoQ.doq.do(self._test_SendSelf)
+
+ def _test_SendSelf(self):
mesgen = self._createMessageMaker()
x = mesgen.generate_message(mesgen.get_id(), 'spam')
pub_key_sexp, message = mesgen.parse(x)
@@ -128,6 +144,9 @@ class MesgenTestCase(unittest.TestCase):
assert message == 'spam'
def test_error(self):
+ DoQ.doq.do(self._test_error)
+
+ def _test_error(self):
mesgenobj = self._createMessageMaker()
x = mesgenobj.generate_message(mesgenobj.get_id(), 'spam')
def tryToRaiseError(mesgenobj=mesgenobj, x=x):
@@ -135,6 +154,9 @@ class MesgenTestCase(unittest.TestCase):
self.failUnlessRaises(mesgen.Error, tryToRaiseError)
def test_SerializeAndReserialize(self):
+ DoQ.doq.do(self._test_SerializeAndReserialize)
+
+ def _test_SerializeAndReserialize(self):
sk = mesgen.SessionKeeper(dbparentdir=self.testdir, dir=None)
id = sk.get_id()
@@ -149,6 +171,9 @@ class MesgenTestCase(unittest.TestCase):
assert sk2.get_public_key() == key
def test_MesgenSpeed(self, iterations=200):
+ DoQ.doq.do(self._test_MesgenSpeed, args=(iterations,))
+
+ def _test_MesgenSpeed(self, iterations=200):
# "200 loop iterations generating and parsing 3 messages each took 2.26 seconds" -greg 2001-05-31 [333Mhz Celeron]
mesgen1 = self._createMessageMaker()
mesgen2 = self._createMessageMaker()
@@ -174,15 +199,3 @@ class MesgenTestCase(unittest.TestCase):
assert message == 'spam3'
stop_time = time.time()
print "%d loop iterations generating and parsing 3 messages each took %3.2f seconds" % (iterations, stop_time-start_time)
-
-def suite():
- DoQ.wrap_test_case(MesgenTestCase)
- suite = unittest.makeSuite(MesgenTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_mojosixbit.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_mojosixbit.py,v
retrieving revision 1.1.1.1
diff -p -u -r1.1.1.1 test_mojosixbit.py
--- egtp/test/test_mojosixbit.py 29 Mar 2003 18:28:43 -0000 1.1.1.1
+++ egtp/test/test_mojosixbit.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_mojosixbit.py,v 1.1.1.1 2003/03/29 18:28:43 myers_carpenter Exp $"
+__revision__ = "$Id: test_mojosixbit.py,v 1.1.1.1.2.1 2003/10/08 22:55:26 warner Exp $"
-import unittest
+from twisted.trial import unittest
from egtp import mojosixbit
@@ -88,16 +88,4 @@ class MojosixbitTestCase(unittest.TestCa
assert mojosixbit._mojosixbit_re.match(b2a(':-)'+chr(num))), ('failed 5:', num, b2a(':-)'+chr(num)))
assert mojosixbit._mojosixbit_re.match(b2a('#8-}'+chr(num))), ('failed 6:', num, b2a('#8-}'+chr(num)))
assert mojosixbit._mojosixbit_re.match(b2a(' ;-} '+chr(num))), ('failed 7:', num, b2a(' ;-} '+chr(num)))
-
-
-def suite():
- suite = unittest.makeSuite(MojosixbitTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_mojoutil.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_mojoutil.py,v
retrieving revision 1.4
diff -p -u -r1.4 test_mojoutil.py
--- egtp/test/test_mojoutil.py 4 May 2003 19:23:10 -0000 1.4
+++ egtp/test/test_mojoutil.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,10 @@
#!/usr/bin/env python
__author__ = 'EGFABT'
-__revision__ = "$Id: test_mojoutil.py,v 1.4 2003/05/04 19:23:10 tschechow Exp $"
+__revision__ = "$Id: test_mojoutil.py,v 1.4.4.1 2003/10/08 22:55:26 warner Exp $"
-import unittest, whrandom
+import whrandom
+from twisted.trial import unittest
from egtp import mojoutil
@@ -190,14 +191,3 @@ class MojoutilTestCase(unittest.TestCase
return f
# <<< please comment me out for distribution -- I am testing and benchmarking code
"""
-
-def suite():
- suite = unittest.makeSuite(MojoutilTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: egtp/test/test_tcpconnection.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/egtp/test/test_tcpconnection.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_tcpconnection.py
--- egtp/test/test_tcpconnection.py 5 Mar 2004 17:33:40 -0000 1.2
+++ egtp/test/test_tcpconnection.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,9 @@
#!/usr/bin/env python
-__author__ = 'EGFABT'
-__revision__ = "$Id: test_tcpconnection.py,v 1.2 2004/03/05 17:33:40 zooko Exp $"
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-import unittest
+from twisted.trial import unittest
import struct
from egtp.TCPConnection import *
@@ -63,16 +63,3 @@ class TCPConnectionTestCase(unittest.Tes
help_test(msgs, (5, 10, 20, 30, 40, 50,))
help_test(msgs, (15, 20, 30, 40, 50,))
help_test(msgs, (15, 17, 23, 40, 50,))
-
-
-
-def suite():
- suite = unittest.makeSuite(TCPConnectionTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: evilcrypto/evilcryptopp.cpp
===================================================================
RCS file: /cvsroot/mnet/mnet_new/evilcrypto/evilcryptopp.cpp,v
retrieving revision 1.2
diff -p -u -r1.2 evilcryptopp.cpp
--- evilcrypto/evilcryptopp.cpp 17 Oct 2003 12:38:44 -0000 1.2
+++ evilcrypto/evilcryptopp.cpp 18 Apr 2004 20:05:16 -0000
@@ -2,7 +2,8 @@
// A module that merges randsource and modval into one external
// module to keep dynamic linking happy.
//
-// $Id: evilcryptopp.cpp,v 1.2 2003/10/17 12:38:44 zooko Exp $
+const static char* __version__ = "$Revision: 1.40 $";
+// $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
#include "integer.h"
Index: evilcrypto/test/test_crypto.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/evilcrypto/test/test_crypto.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_crypto.py
--- evilcrypto/test/test_crypto.py 29 Mar 2003 20:17:10 -0000 1.2
+++ evilcrypto/test/test_crypto.py 18 Apr 2004 20:05:16 -0000
@@ -1,9 +1,10 @@
#!/usr/bin/env python
__author__ = 'Myers Carpenter'
-__revision__ = "$Id: test_crypto.py,v 1.2 2003/03/29 20:17:10 myers_carpenter Exp $"
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-import unittest
+from twisted.trial import unittest
import evilcrypto.aesctr
import evilcrypto.tripledescbc
@@ -43,14 +44,3 @@ class SampleTestCase(unittest.TestCase):
ciphertext = y.encrypt(iv,plaintext)
verify = x.decrypt(iv,ciphertext)
assert verify == plaintext
-
-def suite():
- suite = unittest.makeSuite(SampleTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: evilcrypto/test/test_cryptutil.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/evilcrypto/test/test_cryptutil.py,v
retrieving revision 1.2
diff -p -u -r1.2 test_cryptutil.py
--- evilcrypto/test/test_cryptutil.py 29 Mar 2003 20:17:11 -0000 1.2
+++ evilcrypto/test/test_cryptutil.py 18 Apr 2004 20:05:16 -0000
@@ -5,9 +5,9 @@ BUGBUG this file needs a license, myers
"""
__author__ = 'EGFABT'
-__revision__ = "$Id: test_cryptutil.py,v 1.2 2003/03/29 20:17:11 myers_carpenter Exp $"
+__revision__ = "$Id: test_cryptutil.py,v 1.2.2.1 2003/10/08 22:52:32 warner Exp $"
-import unittest
+from twisted.trial import unittest
from evilcrypto import cryptutil
@@ -47,14 +47,3 @@ class SampleTestCase(unittest.TestCase):
if type(data)==type(1L): data=longtobytes(data)
if type(result)==type(1L): result=longtobytes(result,20)
assert cryptutil.hmac(key,data) == result, "Failed on %s" % repr((key,data,result))
-
-def suite():
- suite = unittest.makeSuite(SampleTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
Index: mnetlib/ent.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/ent.py,v
retrieving revision 1.34
diff -p -u -r1.34 ent.py
--- mnetlib/ent.py 5 Oct 2003 19:41:16 -0000 1.34
+++ mnetlib/ent.py 18 Apr 2004 20:05:16 -0000
@@ -1,6 +1,7 @@
# Copyright (c) 2003 Bryce "Zooko" Wilcox-O'Hearn, Hauke Johannknecht
# mailto:zooko at zooko.com
# See the end of this file for the free software, open source license (BSD-style).
+# -*- test-case-name: mnetlib.test.test_ent -*-
"""\
A nifty newfangled emergent network.
@@ -11,8 +12,8 @@ A nifty newfangled emergent network.
#<zooko> [Fri 07:25] link to them in order to transfer/fallback blocks that are now in the wrong node.
#<zooko> [Fri 07:26] Anyway, let's (a) get basic-ent-routing working, (b) get basic-interface working, (c) get basic-ent-decentralized-filestore working
-__version__ = "$Revision: 1.34 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/ent.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
from pyutil.assertutil import _assert, precondition, postcondition
from pyutil.debugprint import debugprint, debugstream
Index: mnetlib/version.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/version.py,v
retrieving revision 1.172
diff -p -u -r1.172 version.py
--- mnetlib/version.py 18 Apr 2004 18:45:29 -0000 1.172
+++ mnetlib/version.py 18 Apr 2004 20:05:16 -0000
@@ -10,10 +10,9 @@
Contains the version of Mnet.
"""
-__version__ = "$Revision: 1.172 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/version.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-# pyutil modules
from pyutil import VersionNumber
#
@@ -27,7 +26,7 @@ from pyutil import VersionNumber
major = 0 # this will go to `1' when it is ready for widespread public use !?
minor = 7 # release number
micro = 0 # bugfix release number
-nano = 123 # everytime a developer changes anything that anyone might care about, he bumps this one
+nano = 125 # everytime a developer changes anything that anyone might care about, he bumps this one
flag = "UNSTABLE"
versiontup = (major, minor, micro, nano,)
Index: mnetlib/filesystem/datablock.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/filesystem/datablock.py,v
retrieving revision 1.3
diff -p -u -r1.3 datablock.py
--- mnetlib/filesystem/datablock.py 5 Oct 2003 19:09:57 -0000 1.3
+++ mnetlib/filesystem/datablock.py 18 Apr 2004 20:05:16 -0000
@@ -9,8 +9,8 @@ currently in memory in a dict so that yo
so that there are no redundant copies of the block data kept in memory.
"""
-__version__ = "$Revision: 1.3 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/filesystem/datablock.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
import sha, weakref
Index: mnetlib/filesystem/pusher.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/filesystem/pusher.py,v
retrieving revision 1.23
diff -p -u -r1.23 pusher.py
--- mnetlib/filesystem/pusher.py 13 Feb 2004 22:02:01 -0000 1.23
+++ mnetlib/filesystem/pusher.py 18 Apr 2004 20:05:16 -0000
@@ -9,7 +9,8 @@ Pusher is trying to get those blocks to
the metatracker to find blockservers.
"""
-__revision__ = '$Id: pusher.py,v 1.23 2004/02/13 22:02:01 zooko Exp $'
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
import os, sys, traceback, string, time, types, stat, random
import copy, threading, time, traceback, types
Index: mnetlib/test/test_blockwrangler.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_blockwrangler.py,v
retrieving revision 1.22
diff -p -u -r1.22 test_blockwrangler.py
--- mnetlib/test/test_blockwrangler.py 7 Mar 2004 10:32:16 -0000 1.22
+++ mnetlib/test/test_blockwrangler.py 18 Apr 2004 20:05:16 -0000
@@ -4,23 +4,22 @@
# mailto:zooko at zooko.com
# See the end of this file for the free software, open source license (BSD-style).
-# CVS:
-__revision__ = '$Id: test_blockwrangler.py,v 1.22 2004/03/07 10:32:16 zooko Exp $'
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-# Python standard library modules
-import math, profile, pstats, traceback, types, unittest
+import math, profile, pstats, traceback, types
+
+from twisted.trial import unittest
from mnetlib.confutils import confman
# confman['PROFILING'] = "true"
confman['PROFILING'] = "false"
-# pyutil modules
from pyutil import DoQ, eventutil, humanreadable, memutil, randutil, timeutil
from pyutil import nummedobj
from pyutil.debugprint import debugprint
from pyutil import config
-# Mnet modules
from mnetlib.filesystem import blockwrangler
from egtp import idlib
@@ -298,14 +297,6 @@ class GSRWranglerTest(BasicWranglerTest)
BasicWranglerTest.setUp(self)
-
-def suite():
- suites = []
- suites.append(unittest.makeSuite(GSRWranglerTest, 'test'))
-
- return unittest.TestSuite(suites)
-
-
if __name__ == '__main__':
try:
unittest.main()
Index: mnetlib/test/test_bootpage.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_bootpage.py,v
retrieving revision 1.13
diff -p -u -r1.13 test_bootpage.py
--- mnetlib/test/test_bootpage.py 5 Mar 2004 17:33:41 -0000 1.13
+++ mnetlib/test/test_bootpage.py 18 Apr 2004 20:05:16 -0000
@@ -3,10 +3,12 @@
#
# See end of file for license info
-__version__ = "$Revision: 1.13 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/test/test_bootpage.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-import shutil, sys, tempfile, threading, unittest, os
+import shutil, sys, tempfile, threading, os
+
+from twisted.trial import unittest
from pyutil import DoQ
from pyutil.debugprint import debugprint, debugstream
@@ -59,14 +61,6 @@ class Testy(unittest.TestCase):
self._help_test(use_confutils=True, url_list=None)
-def suite():
- suite = unittest.makeSuite(Testy, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
if __name__ == '__main__':
if hasattr(unittest, 'main'):
unittest.main()
Index: mnetlib/test/test_ent.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_ent.py,v
retrieving revision 1.9
diff -p -u -r1.9 test_ent.py
--- mnetlib/test/test_ent.py 5 Mar 2004 17:33:41 -0000 1.9
+++ mnetlib/test/test_ent.py 18 Apr 2004 20:05:17 -0000
@@ -3,10 +3,12 @@
Test ent by setting up an entire simulated network.
"""
-__version__ = "$Revision: 1.9 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/test/test_ent.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-import random, sha, unittest
+import random, sha
+
+from twisted.trial import unittest
myrandom = random.Random()
myrandom.seed(1)
@@ -153,14 +155,5 @@ class SimulEnt(unittest.TestCase):
def test_store_and_fetch_random_nodes(self):
for i in range(2**2):
self._help_test_store_and_fetch(myrandom.randint(0, len(self.rs)), myrandom.randint(0, len(self.rs)))
-
-def DISABLEDsuite():
- suite = unittest.makeSuite(SimulEnt, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-if __name__ == "__main__":
- unittest.main()
+SimulEnt.skip = "runs for a very very long time"
Index: mnetlib/test/test_fec.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_fec.py,v
retrieving revision 1.7
diff -p -u -r1.7 test_fec.py
--- mnetlib/test/test_fec.py 5 Oct 2003 18:22:06 -0000 1.7
+++ mnetlib/test/test_fec.py 18 Apr 2004 20:05:17 -0000
@@ -1,9 +1,11 @@
#!/usr/bin/env python
-__version__ = "$Revision: 1.7 $"
+__version__ = "$Revision: 1.7.2.1 $"
# $Source: /cvsroot/mnet/mnet_new/mnetlib/test/test_fec.py,v $
-import filecmp, gc, math, mmap, os, random, tempfile, unittest
+import filecmp, gc, math, mmap, os, random, tempfile
+
+from twisted.trial import unittest
from mnetlib.filesystem import fec
@@ -146,11 +148,3 @@ class DecodeTestCase(unittest.TestCase):
ff.close()
assert filecmp.cmp(in_file, out_file), "files don't look the same (%r vs %r)" % (in_file, out_file,)
-
-def suite():
- suite1 = unittest.makeSuite(DecodeTestCase, 'test')
- suite2 = unittest.makeSuite(EncodeTestCase, 'test')
- return unittest.TestSuite((suite1, suite2))
-
-if __name__ == "__main__":
- unittest.main()
Index: mnetlib/test/test_localblockstore.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_localblockstore.py,v
retrieving revision 1.23
diff -p -u -r1.23 test_localblockstore.py
--- mnetlib/test/test_localblockstore.py 7 Mar 2004 10:32:16 -0000 1.23
+++ mnetlib/test/test_localblockstore.py 18 Apr 2004 20:05:17 -0000
@@ -1,9 +1,11 @@
#!/usr/bin/env python
-__version__ = "$Revision: 1.23 $"
-# $Source: /cvsroot/mnet/mnet_new/mnetlib/test/test_localblockstore.py,v $
+__version__ = "$Revision: 1.40 $"
+# $Source: /cvsroot/mnet/mnet_new/doc/coding_standards.html,v $
-import pprint, shutil, tempfile, unittest
+import pprint, shutil, tempfile
+
+from twisted.trial import unittest
from egtp import mojosixbit
from pyutil import DoQ
@@ -274,19 +276,3 @@ class RndDeepTestCase(DeepTestCase, UseM
class LRUDeepTestCase(DeepTestCase, UseMntLRU):
pass
-
-def suite():
- suites = []
- suites.append(unittest.makeSuite(RndFlatTestCase, 'test'))
- suites.append(unittest.makeSuite(LRUFlatTestCase, 'test'))
- suites.append(unittest.makeSuite(RndDictTestCase, 'test'))
- suites.append(unittest.makeSuite(LRUDictTestCase, 'test'))
- suites.append(unittest.makeSuite(RndHashTestCase, 'test'))
- suites.append(unittest.makeSuite(LRUHashTestCase, 'test'))
- suites.append(unittest.makeSuite(RndDeepTestCase, 'test'))
- suites.append(unittest.makeSuite(LRUDeepTestCase, 'test'))
-
- return unittest.TestSuite(suites)
-
-if __name__ == "__main__":
- unittest.main()
Index: mnetlib/test/test_znff.py
===================================================================
RCS file: /cvsroot/mnet/mnet_new/mnetlib/test/test_znff.py,v
retrieving revision 1.7
diff -p -u -r1.7 test_znff.py
--- mnetlib/test/test_znff.py 5 Oct 2003 18:22:06 -0000 1.7
+++ mnetlib/test/test_znff.py 18 Apr 2004 20:05:17 -0000
@@ -2,10 +2,12 @@
# author: Myers Carpenter
-__version__ = "$Revision: 1.7 $"
+__version__ = "$Revision: 1.7.2.1 $"
# $Source: /cvsroot/mnet/mnet_new/mnetlib/test/test_znff.py,v $
-import filecmp, os, tempfile, time, unittest
+import filecmp, os, tempfile, time
+
+from twisted.trial import unittest
from mnetlib.filesystem import znff
@@ -110,14 +112,3 @@ class SampleTestCase(unittest.TestCase):
uris.append(en.generate_uri())
self.assertEquals(uris[0], uris[1], "URI's are not the same (%r vs %r)" % (uris[0], uris[1],))
-
-def suite():
- suite = unittest.makeSuite(SampleTestCase, 'test')
-
- # suite2 = module2.TheTestSuite()
- # return unittest.TestSuite((suite1, suite2))
-
- return suite
-
-if __name__ == "__main__":
- unittest.main()
More information about the Mnet-devel
mailing list