[Pkg-bazaar-commits] ./bzr/unstable r720: - start moving external tests into the testsuite framework

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:13:46 UTC 2009


------------------------------------------------------------
revno: 720
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-06-20 15:22:04 +1000
message:
  - start moving external tests into the testsuite framework
added:
  bzrlib/blackbox.py
modified:
  bzrlib/selftest.py
-------------- next part --------------
=== added file 'bzrlib/blackbox.py'
--- a/bzrlib/blackbox.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/blackbox.py	2005-06-20 05:22:04 +0000
@@ -0,0 +1,37 @@
+# Copyright (C) 2005 by Canonical Ltd
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+"""Black-box tests for bzr.
+
+These check that it behaves properly when it's invoked through the regular
+command-line interface.
+"""
+
+# this code was previously in testbzr
+
+from unittest import TestCase
+
+
+
+class TestVersion(TestCase):
+    def runTest(self):
+        from os import system
+        rc = system('bzr version')
+        if rc != 0:
+            fail("command returned status %d" % rc)
+            
+            

=== modified file 'bzrlib/selftest.py'
--- a/bzrlib/selftest.py	2005-06-20 05:09:00 +0000
+++ b/bzrlib/selftest.py	2005-06-20 05:22:04 +0000
@@ -15,32 +15,36 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-import unittest
+from unittest import TestResult, TestCase
 
-class _MyResult(unittest.TestResult):
+class _MyResult(TestResult):
 #     def startTest(self, test):
 #         print str(test).ljust(50),
-#         unittest.TestResult.startTest(self, test)
+#         TestResult.startTest(self, test)
 
 #     def stopTest(self, test):
 #         print
-#         unittest.TestResult.stopTest(self, test)
+#         TestResult.stopTest(self, test)
 
 
     pass
 
 
 
+
 def selftest():
      from unittest import TestLoader, TestSuite
      import bzrlib
      import bzrlib.whitebox
+     import bzrlib.blackbox
      from doctest import DocTestSuite
     
      suite = TestSuite()
-
-     suite.addTest(TestLoader().loadTestsFromModule(bzrlib.whitebox))
-    
+     tl = TestLoader()
+
+     for m in bzrlib.whitebox, bzrlib.blackbox:
+         suite.addTest(tl.loadTestsFromModule(m))
+
      for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \
              bzrlib.commands:
          suite.addTest(DocTestSuite(m))



More information about the Pkg-bazaar-commits mailing list