diff --git a/python/tox.ini b/python/tox.ini
index d5422f8..4e55e62 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -14,7 +14,7 @@ deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
 
 [testenv:pep8]
-commands = flake8
+commands = flake8 --exclude="*testsuite.dir*" ovs/ ovstest/ {toxinidir}/../tests/
 
 [flake8]
 ignore=E111,E113,E126,E127,E128,E129,E131
diff --git a/tests/MockXenAPI.py b/tests/MockXenAPI.py
index cca1571..b8de4ee 100644
--- a/tests/MockXenAPI.py
+++ b/tests/MockXenAPI.py
@@ -14,6 +14,7 @@
 
 import re
 
+
 def xapi_local():
     return Session()
 
@@ -97,6 +98,7 @@ class Pool(Table):
     def __init__(self):
         Table.__init__(self, Pool.__records)
 
+
 class VIF(Table):
     __records = ({"uuid": "6ab1b260-398e-49ba-827b-c7696108964c",
                   "other_config":
@@ -105,6 +107,7 @@ class VIF(Table):
     def __init__(self):
         Table.__init__(self, VIF.__records)
 
+
 class VM(Table):
     __records = ({"uuid": "fcb8a3f6-dc04-41d2-8b8a-55afd2b755b8",
                   "other_config":
diff --git a/tests/test-daemon.py b/tests/test-daemon.py
index b759cf9..63c1f70 100644
--- a/tests/test-daemon.py
+++ b/tests/test-daemon.py
@@ -13,7 +13,6 @@
 # limitations under the License.
 
 import argparse
-import logging
 import signal
 import sys
 import time
diff --git a/tests/test-jsonrpc.py b/tests/test-jsonrpc.py
index fc12caf..18634e6 100644
--- a/tests/test-jsonrpc.py
+++ b/tests/test-jsonrpc.py
@@ -88,7 +88,7 @@ def do_listen(name):
             if error:
                 rpc.close()
                 dead_rpcs.append(rpc)
-        rpcs = [rpc for rpc in rpcs if not rpc in dead_rpcs]
+        rpcs = [rpc for rpc in rpcs if rpc not in dead_rpcs]
 
         if done and not rpcs:
             break
@@ -189,7 +189,7 @@ notify REMOTE METHOD PARAMS  send notification and exit
 
     command_name = args.command[0]
     args = args.command_args
-    if not command_name in commands:
+    if command_name not in commands:
         sys.stderr.write("%s: unknown command \"%s\" "
                          "(use --help for help)\n" % (argv[0], command_name))
         sys.exit(1)
diff --git a/tests/test-l7.py b/tests/test-l7.py
index d15a167..66e05a1 100755
--- a/tests/test-l7.py
+++ b/tests/test-l7.py
@@ -50,7 +50,7 @@ def get_ftpd():
 
 def main():
     SERVERS = {
-        'http':  [TCPServer,   SimpleHTTPRequestHandler, 80],
+        'http': [TCPServer, SimpleHTTPRequestHandler, 80],
         'http6': [TCPServerV6, SimpleHTTPRequestHandler, 80],
     }
 
diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index 8528f33..9d18ec3 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -25,7 +25,7 @@ from ovs.db import error
 import ovs.db.idl
 import ovs.db.schema
 from ovs.db import data
-from ovs.db import types
+import ovs.db.types
 import ovs.ovsuuid
 import ovs.poller
 import ovs.util
@@ -33,15 +33,15 @@ import six
 
 
 def unbox_json(json):
-    if type(json) == list and len(json) == 1:
+    if isinstance(json, list) and len(json) == 1:
         return json[0]
     else:
         return json
 
 
 def do_default_atoms():
-    for type_ in types.ATOMIC_TYPES:
-        if type_ == types.VoidType:
+    for type_ in ovs.db.types.ATOMIC_TYPES:
+        if type_ == ovs.db.types.VoidType:
             continue
 
         sys.stdout.write("%s: " % type_.to_string())
@@ -57,15 +57,16 @@ def do_default_atoms():
 def do_default_data():
     any_errors = False
     for n_min in 0, 1:
-        for key in types.ATOMIC_TYPES:
-            if key == types.VoidType:
+        for key in ovs.db.types.ATOMIC_TYPES:
+            if key == ovs.db.types.VoidType:
                 continue
-            for value in types.ATOMIC_TYPES:
-                if value == types.VoidType:
+            for value in ovs.db.types.ATOMIC_TYPES:
+                if value == ovs.db.types.VoidType:
                     valueBase = None
                 else:
-                    valueBase = types.BaseType(value)
-                type_ = types.Type(types.BaseType(key), valueBase, n_min, 1)
+                    valueBase = ovs.db.types.BaseType(value)
+                type_ = ovs.db.types.Type(ovs.db.types.BaseType(key),
+                                          valueBase, n_min, 1)
                 assert type_.is_valid()
 
                 sys.stdout.write("key %s, value %s, n_min %d: "
@@ -83,25 +84,25 @@ def do_default_data():
 
 def do_parse_atomic_type(type_string):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    atomic_type = types.AtomicType.from_json(type_json)
+    atomic_type = ovs.db.types.AtomicType.from_json(type_json)
     print(ovs.json.to_string(atomic_type.to_json(), sort_keys=True))
 
 
 def do_parse_base_type(type_string):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    base_type = types.BaseType.from_json(type_json)
+    base_type = ovs.db.types.BaseType.from_json(type_json)
     print(ovs.json.to_string(base_type.to_json(), sort_keys=True))
 
 
 def do_parse_type(type_string):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    type_ = types.Type.from_json(type_json)
+    type_ = ovs.db.types.Type.from_json(type_json)
     print(ovs.json.to_string(type_.to_json(), sort_keys=True))
 
 
 def do_parse_atoms(type_string, *atom_strings):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    base = types.BaseType.from_json(type_json)
+    base = ovs.db.types.BaseType.from_json(type_json)
     for atom_string in atom_strings:
         atom_json = unbox_json(ovs.json.from_string(atom_string))
         try:
@@ -113,7 +114,7 @@ def do_parse_atoms(type_string, *atom_strings):
 
 def do_parse_data(type_string, *data_strings):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    type_ = types.Type.from_json(type_json)
+    type_ = ovs.db.types.Type.from_json(type_json)
     for datum_string in data_strings:
         datum_json = unbox_json(ovs.json.from_string(datum_string))
         datum = data.Datum.from_json(type_, datum_json)
@@ -122,7 +123,7 @@ def do_parse_data(type_string, *data_strings):
 
 def do_sort_atoms(type_string, atom_strings):
     type_json = unbox_json(ovs.json.from_string(type_string))
-    base = types.BaseType.from_json(type_json)
+    base = ovs.db.types.BaseType.from_json(type_json)
     atoms = [data.Atom.from_json(base, atom_json)
              for atom_json in unbox_json(ovs.json.from_string(atom_strings))]
     print(ovs.json.to_string([data.Atom.to_json(atom)
@@ -207,9 +208,9 @@ def substitute_uuids(json, symtab):
         symbol = symtab.get(json)
         if symbol:
             return str(symbol)
-    elif type(json) == list:
+    elif isinstance(json, list):
         return [substitute_uuids(element, symtab) for element in json]
-    elif type(json) == dict:
+    elif isinstance(json, dict):
         d = {}
         for key, value in six.iteritems(json):
             d[key] = substitute_uuids(value, symtab)
@@ -223,10 +224,10 @@ def parse_uuids(json, symtab):
         name = "#%d#" % len(symtab)
         sys.stderr.write("%s = %s\n" % (name, json))
         symtab[name] = json
-    elif type(json) == list:
+    elif isinstance(json, list):
         for element in json:
             parse_uuids(element, symtab)
-    elif type(json) == dict:
+    elif isinstance(json, dict):
         for value in six.itervalues(json):
             parse_uuids(value, symtab)
 
@@ -393,7 +394,6 @@ def idl_set(idl, commands, step):
 def do_idl(schema_file, remote, *commands):
     schema_helper = ovs.db.idl.SchemaHelper(schema_file)
     if commands and commands[0].startswith("?"):
-        monitor = {}
         readonly = {}
         for x in commands[0][1:].split("?"):
             readonly = []
@@ -591,21 +591,21 @@ def main(argv):
 
     command_name = args[0]
     args = args[1:]
-    if not command_name in commands:
+    if command_name not in commands:
         sys.stderr.write("%s: unknown command \"%s\" "
                          "(use --help for help)\n" % (ovs.util.PROGRAM_NAME,
                                                       command_name))
         sys.exit(1)
 
     func, n_args = commands[command_name]
-    if type(n_args) == tuple:
+    if isinstance(n_args, tuple):
         if len(args) < n_args[0]:
             sys.stderr.write("%s: \"%s\" requires at least %d arguments but "
                              "only %d provided\n"
                              % (ovs.util.PROGRAM_NAME, command_name,
                                 n_args, len(args)))
             sys.exit(1)
-    elif type(n_args) == int:
+    elif isinstance(n_args, int):
         if len(args) != n_args:
             sys.stderr.write("%s: \"%s\" requires %d arguments but %d "
                              "provided\n"
diff --git a/tests/test-reconnect.py b/tests/test-reconnect.py
index 10d97d1..4ff95ae 100644
--- a/tests/test-reconnect.py
+++ b/tests/test-reconnect.py
@@ -132,7 +132,7 @@ def diff_stats(old, new, delta):
         print(("  %sconnected" % negate))
 
     if (old.last_connected != new.last_connected or
-        (new.msec_since_connect != None and
+        (new.msec_since_connect is not None and
          old.msec_since_connect != new.msec_since_connect - delta) or
         (old.total_connected_duration != new.total_connected_duration - delta
             and not (old.total_connected_duration == 0 and
@@ -141,7 +141,7 @@ def diff_stats(old, new, delta):
               % (new.msec_since_connect, new.total_connected_duration)))
 
     if (old.last_disconnected != new.last_disconnected or
-        (new.msec_since_disconnect != None and
+        (new.msec_since_disconnect is not None and
          old.msec_since_disconnect != new.msec_since_disconnect - delta)):
         print(("  disconnected at %d ms (%d ms ago)"
               % (new.last_disconnected, new.msec_since_disconnect)))
diff --git a/tests/test-unix-socket.py b/tests/test-unix-socket.py
index f55f6c3..aac32bd 100644
--- a/tests/test-unix-socket.py
+++ b/tests/test-unix-socket.py
@@ -20,6 +20,7 @@ import sys
 
 import ovs.socket_util
 
+
 def main(argv):
     if len(argv) not in (2, 3):
         sys.stderr.write("usage: %s SOCKETNAME1 [SOCKETNAME2]", argv[0])
diff --git a/tests/test-unixctl.py b/tests/test-unixctl.py
index ab03479..5de51d3 100644
--- a/tests/test-unixctl.py
+++ b/tests/test-unixctl.py
@@ -22,6 +22,7 @@ import ovs.unixctl.server
 vlog = ovs.vlog.Vlog("test-unixctl")
 exiting = False
 
+
 def unixctl_exit(conn, unused_argv, aux):
     assert aux == "aux_exit"
     global exiting
@@ -36,7 +37,7 @@ def unixctl_echo(conn, argv, aux):
 
 
 def unixctl_echo_error(conn, argv, aux):
-    assert aux ==  "aux_echo_error"
+    assert aux == "aux_echo_error"
     conn.reply_error(str(argv))
 
 
