Closed GoogleCodeExporter closed 8 years ago
I see this is addressed in SVN, but not included in a release. Running the test
suite with Python 2.7 yields a number of errors (Python 2.6 works fine):
.......EError: FLAGS.MainModuleHelp() didn't return the expected result.
Got:
gflags_unittest.py:
--[no]debug: debughelp
(default: 'false')
-?,--[no]help: show this help
--[no]helpshort: show usage only for this module
--[no]helpxml: like --help, but generates XML output
--kwery: <who|what|why|where|when>: ?
--l: how long to be
(default: '9223372032559808512')
(an integer)
--letters: a list of letters
(default: 'a,b,c')
(a comma separated list)
--name: namehelp
(default: 'Bob')
--[no]noexec: boolean flag with no as prefix
(default: 'true')
--numbers: a list of numbers
(default: '1,2,3')
(a comma separated list)
--[no]q: quiet mode
(default: 'true')
--[no]quack: superstring of 'q'
(default: 'false')
-r,--repeat: how many times to repeat (0-5)
(default: '4')
(a non-negative integer)
--x: how eXtreme to be
(default: '3')
(an integer)
[End of got]
Number of help lines = 31, expected 61
One discrepancy: Got:
-?,--[no]help: show this help
Expected:
-u,--[no]dup1: runhelp d12
F...EE.....Warning: Hit circular flagfile dependency:
/tmp/flags_unittest/UnitTestFile3.tst
...........FEE....
======================================================================
ERROR: test_flags (__main__.FlagsUnitTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 194, in test_flags
self.assertEqual(keys, reg_flags)
File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
assertion_func(first, second, msg=msg)
TypeError: assertListEqual() got an unexpected keyword argument 'msg'
======================================================================
ERROR: testKeyFlags (__main__.KeyFlagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 1595, in testKeyFlags
[])
File "gflags_unittest.py", line 1548, in assertListEqual
self.assertEqual(Sorted(list1), Sorted(list2))
File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
assertion_func(first, second, msg=msg)
TypeError: assertListEqual() got an unexpected keyword argument 'msg'
======================================================================
ERROR: testKeyFlagsWithNonDefaultFlagValuesObject (__main__.KeyFlagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 1665, in testKeyFlagsWithNonDefaultFlagValuesObject
[])
File "gflags_unittest.py", line 1548, in assertListEqual
self.assertEqual(Sorted(list1), Sorted(list2))
File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
assertion_func(first, second, msg=msg)
TypeError: assertListEqual() got an unexpected keyword argument 'msg'
======================================================================
ERROR: testMultiNumericalFlags (__main__.MultiNumericalFlagsTest)
Test multi_int and multi_float flags.
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 836, in testMultiNumericalFlags
self.assertListEqual(FLAGS.get('m_int', None), int_defaults)
File "gflags_unittest.py", line 818, in assertListEqual
self.assertEqual(Sorted(list1), Sorted(list2))
File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
assertion_func(first, second, msg=msg)
TypeError: assertListEqual() got an unexpected keyword argument 'msg'
======================================================================
ERROR: testSingleValueDefault (__main__.MultiNumericalFlagsTest)
Test multi_int and multi_float flags with a single default value.
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 858, in testSingleValueDefault
self.assertListEqual(FLAGS.get('m_int1', None), [int_default])
File "gflags_unittest.py", line 818, in assertListEqual
self.assertEqual(Sorted(list1), Sorted(list2))
File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
assertion_func(first, second, msg=msg)
TypeError: assertListEqual() got an unexpected keyword argument 'msg'
======================================================================
FAIL: test_main_module_help (__main__.FlagsUnitTest)
Test MainModuleHelp().
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 811, in test_main_module_help
self.assertMultiLineEqual(expected_help, helpstr)
File "gflags_unittest.py", line 119, in assertMultiLineEqual
self.assert_(MultiLineEqual(expected, actual))
AssertionError: False is not true
======================================================================
FAIL: testBadMultiNumericalFlags (__main__.MultiNumericalFlagsTest)
Test multi_int and multi_float flags with non-parseable values.
----------------------------------------------------------------------
Traceback (most recent call last):
File "gflags_unittest.py", line 879, in testBadMultiNumericalFlags
flags.DEFINE_multi_float, 'm_float2', ['abc'], 'desc')
File "gflags_unittest.py", line 825, in assertRaisesWithRegexpMatch
'"%s" does not match "%s"' % (regexp, why))
AssertionError: "flag --m_float2=abc: invalid literal for float\(\): abc" does
not match "flag --m_float2=abc: could not convert string to float: abc"
----------------------------------------------------------------------
Ran 37 tests in 0.025s
FAILED (failures=2, errors=5)
Original comment by soren@linux2go.dk
on 14 Jun 2011 at 12:30
The attached patch makes the test suite pass with python 2.7.
Original comment by soren@linux2go.dk
on 14 Jun 2011 at 12:55
Attachments:
Drat! -- I just released gflags 1.6, without having seen this bug report. I
think I'm not getting mail for these bug reports for some reason. I'll look
into the project settings about that.
I refactored the tests for gflags 1.6, which may have improved things somewhat,
but probably don't fix all tests for python 2.7. If not, can you send a
revised patch that fixes it? I'll get that in for the next release.
Original comment by csilv...@gmail.com
on 29 Jul 2011 at 7:54
It looks like the problem here is that unittest defines assertListEqual in
python 2.7, but not before.
However, according to
http://docs.python.org/library/unittest.html
the same is true for assertMultiLineEqual. I'd think that we'd want to fix
both of them.
Ah, I see, unittest.py uses assertListEqual internally, and gets upset at our
override. That's not true of assertMultiLineEqual. Still, I think it's better
to treat them the same. OK, I'll look to fix these for the next release.
Original comment by csilv...@gmail.com
on 2 Aug 2011 at 1:55
This should be fixed as of r24. Feel free to reopen if that's not true (I
don't have python2.7 handy to test it).
Original comment by csilv...@gmail.com
on 26 Aug 2011 at 12:10
Original issue reported on code.google.com by
soren@linux2go.dk
on 14 Jun 2011 at 12:03