~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2007-08-16 03:30:21 UTC
  • mto: This revision was merged to the branch mainline in revision 576.
  • Revision ID: aaron.bentley@utoronto.ca-20070816033021-e9k6t6rj25ndlhrk
Allow zap --force to delete modified checkouts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from bzrlib.tests.blackbox import ExternalBase
 
1
from bzrlib.tests import TestCaseWithTransport
2
2
from unittest import makeSuite
3
3
import os.path
4
 
class TestBzrTools(ExternalBase):
 
4
class TestBzrTools(TestCaseWithTransport):
5
5
    @staticmethod
6
6
    def touch(filename):
7
7
        file(filename, 'wb').write('')
91
91
        self.assertIs(False, os.path.exists('checkout'))
92
92
        self.assertIs(True, os.path.exists('source'))
93
93
 
 
94
    def test_zap_modified(self):
 
95
        tree = self.make_branch_and_tree('source')
 
96
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
 
97
        self.build_tree(['checkout/file'])
 
98
        checkout.add('file')
 
99
        self.run_bzr_error(('This checkout has uncommitted changes',),
 
100
                           'zap checkout')
 
101
        self.failUnlessExists('checkout')
 
102
        self.run_bzr('zap checkout --force')
 
103
        self.failIfExists('checkout')
 
104
        self.failUnlessExists('source')
 
105
 
94
106
    def test_zap_branch(self):
95
107
        self.run_bzr('init source')
96
108
        self.run_bzr('checkout --lightweight source checkout')