# HG changeset patch # User Augie Fackler # Date 1509282432 14400 # Node ID adba152a51778fc64d599f8d307dece42ed844c6 # Parent c0fc42713ecbe1ff1b144582ada5d3830366d153 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. diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -289,8 +289,17 @@ def fileurl(path): url = 'file://%s%s' % (drive, path) return url +class _testui(ui.ui): + def develwarn(self, msg, stacklevel=1, *args, **kwargs): + from hgsubversion import util + if util.smartset is not None: + config = args[0] if args else kwargs['config'] + raise Exception('flunked develwarn: %r (%r)' % (msg, config)) + return ui.ui.develwarn(self, msg, stacklevel=stacklevel, + *args, **kwargs) + def testui(stupid=False, layout='auto', startrev=0): - u = ui.ui() + u = _testui() bools = {True: 'true', False: 'false'} u.setconfig('ui', 'quiet', bools[True]) u.setconfig('ui', 'username', 'automated tests')