author Gregory Szorc <gps@mozilla.com>
Tue, 28 Oct 2014 11:43:34 -0700
changeset 360276 7db4622ae530570abaf69b6ce2ffc6b08bdaa3d8
parent 359886 54cd3ca90d5da38687764f5284950ecdc3f88ff1
permissions -rw-r--r--
testing: add vcttesting to virtualenv The support modules in the vcttesting package are becoming increasingly popular. This directory currently must be manually added to sys.path. This is annoying. This patch adds packaging to vcttesting so it is available in our virtualenv. Scripts manually adding the testing directory to sys.path have been updated to no longer do this.

# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

"""This extension is used during testing to find bad imports.

It introduces a command that is used to test if bad imports are detected.
The extension is presumably loaded with other extensions that trigger bad

Once the test harness runs on Windows, we can probably remove this.
See bug 1096499.

import sys

from mercurial import (


cmdtable = {}
command = cmdutil.command(cmdtable)

commands.norepo += ' findbadimports'

@command('findbadimports', [], ('hg findbadimports'))
def findbadimports(ui):
    have_bad = False
    for m in sorted(BAD_MODULES):
        if m in sys.modules:
            ui.write('bad import: %s\n' % m)
            have_bad = True

    return have_bad