Commit 82e7d9f1 authored by Julien Muchembled's avatar Julien Muchembled

neo/tests/__init__.py: small cleanups

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2663 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent cf559958
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os import os
import sys
import random import random
import unittest import socket
import sys
import tempfile import tempfile
import unittest
import MySQLdb import MySQLdb
import socket
import neo import neo
from mock import Mock from mock import Mock
...@@ -38,7 +38,7 @@ DB_USER = os.getenv('NEO_DB_USER', 'test') ...@@ -38,7 +38,7 @@ DB_USER = os.getenv('NEO_DB_USER', 'test')
IP_VERSION_FORMAT_DICT = { IP_VERSION_FORMAT_DICT = {
socket.AF_INET: '127.0.0.1', socket.AF_INET: '127.0.0.1',
socket.AF_INET6: '::1', socket.AF_INET6: '::1',
} }
ADDRESS_TYPE = socket.AF_INET ADDRESS_TYPE = socket.AF_INET
...@@ -47,9 +47,8 @@ def buildUrlFromString(address): ...@@ -47,9 +47,8 @@ def buildUrlFromString(address):
try: try:
socket.inet_pton(socket.AF_INET6, address) socket.inet_pton(socket.AF_INET6, address)
address = '[%s]' % address address = '[%s]' % address
except: except Exception:
pass pass
return address return address
class NeoTestBase(unittest.TestCase): class NeoTestBase(unittest.TestCase):
...@@ -438,8 +437,9 @@ connector_cpt = 0 ...@@ -438,8 +437,9 @@ connector_cpt = 0
class DoNothingConnector(Mock): class DoNothingConnector(Mock):
def __init__(self, s=None): def __init__(self, s=None):
neo.lib.logging.info("initializing connector") neo.lib.logging.info("initializing connector")
self.desc = globals()['connector_cpt'] global connector_cpt
globals()['connector_cpt'] = globals()['connector_cpt']+ 1 self.desc = connector_cpt
connector_cpt += 1
self.packet_cpt = 0 self.packet_cpt = 0
Mock.__init__(self) Mock.__init__(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment