comparison tests/test_util.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 b3e41b0d50a2
children 8410a978c650
comparison
equal deleted inserted replaced
1540:c0fc42713ecb 1541:adba152a5177
287 # simplify svn info tests. 287 # simplify svn info tests.
288 drive = '/' + drive.upper() 288 drive = '/' + drive.upper()
289 url = 'file://%s%s' % (drive, path) 289 url = 'file://%s%s' % (drive, path)
290 return url 290 return url
291 291
292 class _testui(ui.ui):
293 def develwarn(self, msg, stacklevel=1, *args, **kwargs):
294 from hgsubversion import util
295 if util.smartset is not None:
296 config = args[0] if args else kwargs['config']
297 raise Exception('flunked develwarn: %r (%r)' % (msg, config))
298 return ui.ui.develwarn(self, msg, stacklevel=stacklevel,
299 *args, **kwargs)
300
292 def testui(stupid=False, layout='auto', startrev=0): 301 def testui(stupid=False, layout='auto', startrev=0):
293 u = ui.ui() 302 u = _testui()
294 bools = {True: 'true', False: 'false'} 303 bools = {True: 'true', False: 'false'}
295 u.setconfig('ui', 'quiet', bools[True]) 304 u.setconfig('ui', 'quiet', bools[True])
296 u.setconfig('ui', 'username', 'automated tests') 305 u.setconfig('ui', 'username', 'automated tests')
297 u.setconfig('extensions', 'hgsubversion', '') 306 u.setconfig('extensions', 'hgsubversion', '')
298 u.setconfig('hgsubversion', 'stupid', bools[stupid]) 307 u.setconfig('hgsubversion', 'stupid', bools[stupid])