view tests/comprehensive/test_obsstore_on.py @ 1541:adba152a5177

test_util: make developer warnings cause our tests to fail Previously hgsubversion didn't get any help from develwarn calls, because we don't use core's testrunner. The upstream configitem refactor was easier to hunt down using the develwarn being a failure, which prompted this code. It also exposed several locking correctness bugs, so it feels like it's worth keeping around long term. We don't bother with develwarn on anything so old that we don't try to use smartset. The smartset deprecation was not handled gracefully, so hg complains for many versions without actually breaking anything, and it'd pointlessly complicate our code to handle smartset living in multiple places between when the warning was introduced and the present.
author Augie Fackler <raf@durin42.com>
date Sun, 29 Oct 2017 09:07:12 -0400
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)