view tests/comprehensive/test_obsstore_on.py @ 1547:910f56f0d09c

revset: make "fromsvn()" lazy "fromsvn()" could be a huge revset. Therefore a lazy version makes more sense. This also resolves a subtle ordering issue. See https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-August/103368.html for the context.
author Jun Wu <quark@fb.com>
date Tue, 19 Dec 2017 14:18:01 -0800
parents fbc22592f4fa
children
line wrap: on
line source

import os
import sys

# wrapped in a try/except because of weirdness in how
# run.py works as compared to nose.
try:
    import test_util
except ImportError:
    sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
    import test_util

import test_push_command


class ObsstoreOnMixIn(object):
    # do not double the test size by being wrapped again
    obsolete_mode_tests = False
    stupid_mode_tests = False

    def setUp(self):
        super(ObsstoreOnMixIn, self).setUp()
        hgrcpath = os.environ.get('HGRCPATH')
        assert hgrcpath
        with open(hgrcpath, 'a') as f:
            f.write('\n[experimental]\nevolution=createmarkers\n')

    def shortDescription(self):
        text = super(ObsstoreOnMixIn, self).shortDescription()
        if text:
            text += ' (obsstore on)'
        return text


def buildtestclass(cls):
    name = 'ObsstoreOn%s' % cls.__name__
    newcls = type(name, (ObsstoreOnMixIn, cls,), {})
    globals()[name] = newcls


buildtestclass(test_push_command.PushTests)