More python3 fixes. Run pyip6 doctests in test suite.

This commit is contained in:
Stuart D. Gathman
2016-08-11 15:38:07 -04:00
parent 6e2153454a
commit 547fb39f2a
4 changed files with 9 additions and 3 deletions
+4
View File
@@ -0,0 +1,4 @@
*.pyc
build/
test/*.out
test/*.tstout
+1 -1
View File
@@ -9,7 +9,7 @@
# This code is under the GNU General Public License. See COPYING for details. # This code is under the GNU General Public License. See COPYING for details.
from __future__ import print_function from __future__ import print_function
__version__ = '0.9.8' __version__ = '1.0.1'
import os import os
import re import re
+2 -2
View File
@@ -81,7 +81,7 @@ def inet_pton(p):
(0, 0, 0, 0, 0, 65535, 258, 772) (0, 0, 0, 0, 0, 65535, 258, 772)
>>> try: inet_pton('::1.2.3.4.5') >>> try: inet_pton('::1.2.3.4.5')
... except ValueError,x: print(x) ... except ValueError as x: print(x)
::1.2.3.4.5 ::1.2.3.4.5
""" """
if p == '::': if p == '::':
@@ -115,4 +115,4 @@ def inet_pton(p):
return struct.pack('!HHHHHHHH', return struct.pack('!HHHHHHHH',
*[int(s,16) for s in a[0].split(':')]) *[int(s,16) for s in a[0].split(':')])
except ValueError: pass except ValueError: pass
raise ValueError,p raise ValueError(p)
+2
View File
@@ -5,6 +5,7 @@ import os
import Milter.utils import Milter.utils
from Milter.cache import AddrCache from Milter.cache import AddrCache
from Milter.dynip import is_dynip from Milter.dynip import is_dynip
from Milter.pyip6 import inet_ntop
class AddrCacheTestCase(unittest.TestCase): class AddrCacheTestCase(unittest.TestCase):
@@ -48,6 +49,7 @@ def suite():
s = unittest.makeSuite(AddrCacheTestCase,'test') s = unittest.makeSuite(AddrCacheTestCase,'test')
s.addTest(doctest.DocTestSuite(Milter.utils)) s.addTest(doctest.DocTestSuite(Milter.utils))
s.addTest(doctest.DocTestSuite(Milter.dynip)) s.addTest(doctest.DocTestSuite(Milter.dynip))
s.addTest(doctest.DocTestSuite(Milter.pyip6))
return s return s
if __name__ == '__main__': if __name__ == '__main__':