~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_import_tariff.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-03 21:58:42 UTC
  • mto: (5816.3.1 serve-tariff-wt)
  • mto: This revision was merged to the branch mainline in revision 5817.
  • Revision ID: jelmer@samba.org-20110503215842-5vkrcpwyfh51v7d4
Factor out start_bzr_subprocess_with_import_check

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
            self.preserved_env_vars[name] = os.environ.get(name)
44
44
        super(TestImportTariffs, self).setUp()
45
45
 
46
 
    def run_command_check_imports(self, args, forbidden_imports):
47
 
        """Run bzr ARGS in a subprocess and check its imports.
 
46
    def start_bzr_subprocess_with_import_check(self, args):
 
47
        """Run a bzr process and capture the imports.
48
48
 
49
49
        This is fairly expensive because we start a subprocess, so we aim to
50
50
        cover representative rather than exhaustive cases.
51
 
 
52
 
        :param forbidden_imports: List of fully-qualified Python module names
53
 
            that should not be loaded while running this command.
54
51
        """
55
52
        # We use PYTHON_VERBOSE rather than --profile-importts because in
56
53
        # experimentation the profile-imports output seems to not always show
63
60
        # explicitly do want to test against things installed there, therefore
64
61
        # we pass it through.
65
62
        env_changes = dict(PYTHONVERBOSE='1', **self.preserved_env_vars)
66
 
        process = self.start_bzr_subprocess(args, env_changes=env_changes,
67
 
                                            allow_plugins=(not are_plugins_disabled()))
 
63
        return self.start_bzr_subprocess(args, env_changes=env_changes,
 
64
            allow_plugins=(not are_plugins_disabled()))
 
65
 
 
66
    def run_command_check_imports(self, args, forbidden_imports):
 
67
        """Run bzr ARGS in a subprocess and check its imports.
 
68
 
 
69
        This is fairly expensive because we start a subprocess, so we aim to
 
70
        cover representative rather than exhaustive cases.
 
71
 
 
72
        :param forbidden_imports: List of fully-qualified Python module names
 
73
            that should not be loaded while running this command.
 
74
        """
 
75
        process = self.start_bzr_subprocess_with_import_check(args)
68
76
        (out, err) = self.finish_bzr_subprocess(process,
69
77
            universal_newlines=False, process_args=args)
70
78