~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_import_tariff.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    """
37
37
 
38
38
    def run_command_check_imports(self, args, forbidden_imports):
 
39
        """Run bzr ARGS in a subprocess and check its imports.
 
40
 
 
41
        This is fairly expensive because we start a subprocess, so we aim to
 
42
        cover representative rather than exhaustive cases.
 
43
 
 
44
        :param forbidden_imports: List of fully-qualified Python module names
 
45
            that should not be loaded while running this command.
 
46
        """
39
47
        # We use PYTHON_VERBOSE rather than --profile-importts because in
40
48
        # experimentation the profile-imports output seems to not always show
41
49
        # the modules you'd expect; this can be debugged but python -v seems
82
90
        # 'st' in a working tree shouldn't need many modules
83
91
        self.make_branch_and_tree('.')
84
92
        self.run_command_check_imports(['st'], [
 
93
            'bzrlib.bundle.commands',
 
94
            'bzrlib.cmd_version_info',
 
95
            'bzrlib.foreign',
85
96
            'bzrlib.remote',
 
97
            'bzrlib.sign_my_commits',
86
98
            'bzrlib.smart',
87
99
            'smtplib',
88
100
            'tarfile',
89
101
            ])
 
102
        # TODO: similar test for repository-only operations, checking we avoid
 
103
        # loading wt-specific stuff
 
104
        #
 
105
        # See https://bugs.edge.launchpad.net/bzr/+bug/553017