~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Martin Pool
  • Date: 2010-07-21 09:58:42 UTC
  • mfrom: (4797.58.7 2.1)
  • mto: (5050.3.13 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: mbp@canonical.com-20100721095842-hz0obu8gl0x05nty
merge up 2.1 to 2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
    def test_scenarios(self):
209
209
        # check that constructor parameters are passed through to the adapted
210
210
        # test.
211
 
        from bzrlib.tests.per_controldir import make_scenarios
 
211
        from bzrlib.tests.per_bzrdir import make_scenarios
212
212
        vfs_factory = "v"
213
213
        server1 = "a"
214
214
        server2 = "b"
801
801
        self.requireFeature(test_lsprof.LSProfFeature)
802
802
        result_stream = StringIO()
803
803
        result = bzrlib.tests.VerboseTestResult(
804
 
            result_stream,
 
804
            unittest._WritelnDecorator(result_stream),
805
805
            descriptions=0,
806
806
            verbosity=2,
807
807
            )
862
862
        # verbose test output formatting
863
863
        result_stream = StringIO()
864
864
        result = bzrlib.tests.VerboseTestResult(
865
 
            result_stream,
 
865
            unittest._WritelnDecorator(result_stream),
866
866
            descriptions=0,
867
867
            verbosity=2,
868
868
            )
878
878
        output = result_stream.getvalue()[prefix:]
879
879
        lines = output.splitlines()
880
880
        self.assertContainsRe(lines[0], r'XFAIL *\d+ms$')
881
 
        if sys.version_info > (2, 7):
882
 
            self.expectFailure("_ExpectedFailure on 2.7 loses the message",
883
 
                self.assertNotEqual, lines[1], '    ')
884
881
        self.assertEqual(lines[1], '    foo')
885
882
        self.assertEqual(2, len(lines))
886
883
 
920
917
        # verbose test output formatting
921
918
        result_stream = StringIO()
922
919
        result = bzrlib.tests.VerboseTestResult(
923
 
            result_stream,
 
920
            unittest._WritelnDecorator(result_stream),
924
921
            descriptions=0,
925
922
            verbosity=2,
926
923
            )
1422
1419
        sample_test = TestTestCase("method_that_times_a_bit_twice")
1423
1420
        output_stream = StringIO()
1424
1421
        result = bzrlib.tests.VerboseTestResult(
1425
 
            output_stream,
 
1422
            unittest._WritelnDecorator(output_stream),
1426
1423
            descriptions=0,
1427
1424
            verbosity=2)
1428
1425
        sample_test.run(result)
2340
2337
            os.chdir = orig_chdir
2341
2338
        self.assertEqual(['foo', 'current'], chdirs)
2342
2339
 
2343
 
    def test_get_bzr_path_with_cwd_bzrlib(self):
2344
 
        self.get_source_path = lambda: ""
2345
 
        self.overrideAttr(os.path, "isfile", lambda path: True)
2346
 
        self.assertEqual(self.get_bzr_path(), "bzr")
2347
 
 
2348
2340
 
2349
2341
class TestActuallyStartBzrSubprocess(tests.TestCaseWithTransport):
2350
2342
    """Tests that really need to do things with an external bzr."""