def setUp(self):
        if 'CONARY_IDGEN' in os.environ:
            className = os.environ['CONARY_IDGEN'] % "IdGen%s"
            cook._IdGen = sys.modules[__name__].__dict__[className]

        self.tmpDir = testhelp.getTempDir('conarytest-')
        self.workDir = self.tmpDir + "/work"
        self.buildDir = self.tmpDir + "/build"
        self.rootDir = self.tmpDir + "/root"
        self.cacheDir = self.tmpDir + "/cache"
        self.configDir = self.tmpDir + "/cfg"

        self.cfg = conarycfg.ConaryConfiguration(False)
        self.cfg.name = 'Test'
        self.cfg.contact = 'http://bugzilla.rpath.com/'
        self.cfg.installLabelPath = conarycfg.CfgLabelList([ self.defLabel ])
        self.cfg.installLabel = self.defLabel
        self.cfg.buildLabel = self.defLabel
        self.cfg.buildPath = self.buildDir
        self.cfg.dbPath = '/var/lib/conarydb'
        self.cfg.debugRecipeExceptions = False
        self.cfg.repositoryMap.clear()
        self.cfg.useDir = None
        self.cfg.quiet = True
        self.cfg.resolveLevel = 1
        self.cfg.user.addServerGlob('*', 'test', 'foo')
        # Keep HTTP retries from blocking the testsuite.
        self.cfg.connectAttempts = 1

        global _proxy
        self.proxy = _proxy

        # set the siteConfigPath to be absolute, only including the
        # files from the current conary that's being tested.
        conaryDir = resources.get_path()
        if conaryDir.startswith('/usr') or '_ROOT_' in conaryDir:
            if '_ROOT_' in conaryDir:
                # we're doing testall - use a different path
                offset = conaryDir.index('_ROOT_') + len('_ROOT_')
            else:
                offset = 0
            siteDir = conaryDir[:offset] + '/etc/conary/site'
            componentDir = conaryDir[:offset] + '/etc/conary/components'
        else:
            siteDir = conaryDir + '/config/site'
            componentDir = conaryDir + '/config/components'
        self.cfg.siteConfigPath = [ cfgtypes.Path(siteDir) ]
        self.cfg.componentDirs = [ cfgtypes.Path(componentDir) ]

        # this causes too much trouble; turn it on only for the
        # test(s) where we care
        self.cfg.configComponent = False

        self.cfg.root = self.rootDir
        self.cfg.lookaside = self.cacheDir
        os.umask(0022)

        # set up the flavor based on the defaults in use
        self.initializeFlavor()
        self._origDir = os.getcwd()
        testhelp.TestCase.setUp(self)

        self.cfg.buildLabel = self.defLabel
        self.cfg.installLabelPath = conarycfg.CfgLabelList([self.defLabel])
        self.cfg.defaultMacros = [
                resources.get_archive('macros'),
                resources.get_archive('macros.d', '*'),
                resources.get_archive('site'),
                ]
        self.cfg.siteConfigPath = [resources.get_archive('site')]
        self.logFilter.clear()
        self.cfg.sourceSearchDir = self.sourceSearchDir = resources.get_archive()
        self.cfg.enforceManagedPolicy = False
        self.cfg.resolveLevel = 2
        self.cfg.updateThreshold = 10
        policyPath = os.environ.get('CONARY_POLICY_PATH',
                                    '/usr/lib/conary/policy').split(':')
        self.cfg.policyDirs = policyPath
        self.cfg.baseClassDir = self.tmpDir + "/baseclasses"

        # set up the keyCache so that it won't prompt for passwords in
        # any of the test suites.
        keyCache = openpgpkey.OpenPGPKeyFileCache()
        openpgpkey.setKeyCache(keyCache)

        # pre-populate private key cache
        keyCache.setPrivatePath(resources.get_archive('secring.gpg'))
        self.prepopulateKeyCache(keyCache)

        # Create dummy keyring
        pubRing = util.joinPaths(self.configDir, 'gpg', 'pubring.gpg')

        # pre-populate public key cache
        self.cfg.pubRing = [ pubRing, resources.get_archive('pubring.gpg') ]
        keyCache.setPublicPath(self.cfg.pubRing)
        keyCache.getPublicKey('')

        self.origTroveVersion = (trove.TROVE_VERSION, trove.TROVE_VERSION_1_1)

        if not os.path.exists(self.tmpDir):
            os.mkdir(self.tmpDir)
        os.mkdir(self.workDir)
        os.mkdir(self.rootDir)
        os.mkdir(self.cacheDir)
        os.mkdir(self.configDir)

        # save the original environment
        self.origEnv = dict(os.environ)
        # default recipes only need to be loaded for certain tests
        loadrecipe._defaultsLoaded = True

        # Reset IP cache
        httputils.IPCache.clear()
dataset/ETHPy150Open sassoftware/conary/conary_test/rephelp.py/RepositoryHelper.setUp/swapped operands of `%`