~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_commit.py

(gz) Close files more promptly in tests to avoid issues on pypy (Wouter van
 Heyst)

Show diffs side-by-side

added added

removed removed

Lines of Context:
552
552
        """Make sure a start commit hook can modify the tree that is
553
553
        committed."""
554
554
        def start_commit_hook_adds_file(tree):
555
 
            open(tree.abspath("newfile"), 'w').write("data")
 
555
            with open(tree.abspath("newfile"), 'w') as f: f.write("data")
556
556
            tree.add(["newfile"])
557
557
        def restoreDefaults():
558
558
            mutabletree.MutableTree.hooks['start_commit'] = []
573
573
                mutabletree.PostCommitHookParams))
574
574
            self.assertTrue(isinstance(params.mutable_tree,
575
575
                mutabletree.MutableTree))
576
 
            open(tree.abspath("newfile"), 'w').write("data")
 
576
            with open(tree.abspath("newfile"), 'w') as f: f.write("data")
577
577
            params.mutable_tree.add(["newfile"])
578
578
        tree = self.make_branch_and_tree('.')
579
579
        mutabletree.MutableTree.hooks.install_named_hook(