Browse Source

Merge "fix tox python3 overrides"

Zuul 5 months ago
parent
commit
dd5055f444

+ 7
- 1
.pylintrc View File

@@ -53,7 +53,13 @@ disable=
53 53
  too-many-locals,
54 54
  too-many-public-methods,
55 55
  too-many-return-statements,
56
- too-many-statements
56
+ too-many-statements,
57
+ inconsistent-return-statements,
58
+ useless-object-inheritance,
59
+ too-many-nested-blocks,
60
+ too-many-boolean-expressions,
61
+ not-callable
62
+
57 63
 
58 64
 [BASIC]
59 65
 # Variable names can be 1 to 31 characters long, with lowercase and underscores

+ 2
- 1
lower-constraints.txt View File

@@ -102,7 +102,8 @@ pycparser==2.18
102 102
 pyflakes==0.8.1
103 103
 Pygments==2.2.0
104 104
 pyinotify==0.9.6
105
-pylint==1.4.5
105
+pylint==1.9.3;python_version=='2.7'
106
+pylint==2.1.1;python_version>='3.0'
106 107
 pyOpenSSL==17.1.0
107 108
 pyparsing==2.1.0
108 109
 pyperclip==1.5.27

+ 2
- 2
networking_ovn/agent/metadata/server.py View File

@@ -25,7 +25,7 @@ from oslo_config import cfg
25 25
 from oslo_log import log as logging
26 26
 from oslo_utils import encodeutils
27 27
 import six
28
-import six.moves.urllib.parse as urlparse
28
+from six.moves import urllib
29 29
 import webob
30 30
 
31 31
 from networking_ovn._i18n import _
@@ -100,7 +100,7 @@ class MetadataProxyHandler(object):
100 100
                                     self.conf.nova_metadata_port)
101 101
         LOG.debug('Request to Nova at %s', nova_host_port)
102 102
         LOG.debug(headers)
103
-        url = urlparse.urlunsplit((
103
+        url = urllib.parse.urlunsplit((
104 104
             self.conf.nova_metadata_protocol,
105 105
             nova_host_port,
106 106
             req.path_info,

+ 2
- 2
networking_ovn/common/acl.py View File

@@ -96,7 +96,7 @@ def _get_protocol_number(protocol):
96 96
         return
97 97
     try:
98 98
         protocol = int(protocol)
99
-        if protocol >= 0 and protocol <= 255:
99
+        if 0 <= protocol <= 255:
100 100
             return str(protocol)
101 101
     except (ValueError, TypeError):
102 102
         protocol = PROTOCOL_NAME_TO_NUM_MAP.get(protocol)
@@ -455,7 +455,7 @@ def update_acls_for_security_group(plugin,
455 455
 
456 456
     if not update_port_list:
457 457
         return
458
-    lswitch_names = set([p['network_id'] for p in update_port_list])
458
+    lswitch_names = {p['network_id'] for p in update_port_list}
459 459
 
460 460
     ovn.update_acls(list(lswitch_names),
461 461
                     iter(update_port_list),

+ 2
- 2
networking_ovn/common/ovn_client.py View File

@@ -84,9 +84,9 @@ class OVNClient(object):
84 84
     def _transaction(self, commands, txn=None):
85 85
         """Create a new transaction or add the commands to an existing one."""
86 86
         if txn is None:
87
-            with self._nb_idl.transaction(check_error=True) as txn:
87
+            with self._nb_idl.transaction(check_error=True) as new_txn:
88 88
                 for cmd in commands:
89
-                    txn.add(cmd)
89
+                    new_txn.add(cmd)
90 90
         else:
91 91
             for cmd in commands:
92 92
                 txn.add(cmd)

+ 1
- 1
networking_ovn/l3/l3_ovn.py View File

@@ -349,7 +349,7 @@ class OVNL3RouterPlugin(service_base.ServicePluginBase,
349 349
             'device_owner': [n_const.DEVICE_OWNER_ROUTER_GW],
350 350
             'fixed_ips': {'subnet_id': [orig['id']]},
351 351
         })
352
-        router_ids = set([port['device_id'] for port in gw_ports])
352
+        router_ids = {port['device_id'] for port in gw_ports}
353 353
         remove = [{'destination': '0.0.0.0/0', 'nexthop': orig_gw_ip}
354 354
                   ] if orig_gw_ip else []
355 355
         add = [{'destination': '0.0.0.0/0', 'nexthop': current_gw_ip}

+ 1
- 1
networking_ovn/ovsdb/impl_idl_ovn.py View File

@@ -791,7 +791,7 @@ class OvsdbSbOvnIdl(sb_impl_idl.OvnSbApiIdlImpl, Backend):
791 791
     def set_port_cidrs(self, name, cidrs):
792 792
         # TODO(twilson) add if_exists to db commands
793 793
         return self.db_set('Port_Binding', name, 'external_ids',
794
-                           {'neutron-port-cidrs': cidrs}, if_exists=True)
794
+                           {'neutron-port-cidrs': cidrs})
795 795
 
796 796
     def get_ports_on_chassis(self, chassis):
797 797
         # TODO(twilson) Some day it would be nice to stop passing names around

+ 2
- 1
test-requirements.txt View File

@@ -12,7 +12,8 @@ openstackdocstheme>=1.18.1 # Apache-2.0
12 12
 doc8>=0.6.0 # Apache-2.0
13 13
 oslotest>=3.2.0 # Apache-2.0
14 14
 os-testr>=1.0.0 # Apache-2.0
15
-pylint==1.4.5 # GPLv2
15
+pylint==1.9.3;python_version=='2.7' # GPLv2
16
+pylint==2.1.1;python_version>='3.0' # GPLv2
16 17
 testresources>=2.0.0 # Apache-2.0/BSD
17 18
 testscenarios>=0.4 # Apache-2.0/BSD
18 19
 WebTest>=2.0.27 # MIT

+ 5
- 3
tox.ini View File

@@ -19,13 +19,14 @@ commands =
19 19
 passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
20 20
 
21 21
 [testenv:pep8]
22
-basepython = python2.7
22
+basepython = python3
23 23
 commands = flake8
24 24
            {toxinidir}/tools/coding-checks.sh --pylint '{posargs}'
25 25
            doc8 doc/source devstack releasenotes/source vagrant rally-jobs
26 26
            neutron-db-manage --subproject=networking-ovn check_migration
27 27
 
28 28
 [testenv:venv]
29
+basepython = python3
29 30
 commands = {posargs}
30 31
 
31 32
 [testenv:functional]
@@ -66,7 +67,7 @@ commands =
66 67
   {toxinidir}/tools/ostestr_compat_shim.sh {posargs}
67 68
 
68 69
 [testenv:cover]
69
-basepython = python2.7
70
+basepython = python3
70 71
 setenv =
71 72
   {[testenv]setenv}
72 73
   PYTHON=coverage run --source networking_ovn --parallel-mode
@@ -78,7 +79,7 @@ commands =
78 79
   coverage xml -o cover/coverage.xml
79 80
 
80 81
 [testenv:docs]
81
-basepython = python2.7
82
+basepython = python3
82 83
 commands =
83 84
   rm -rf doc/build
84 85
   doc8 doc/source devstack releasenotes/source vagrant rally-jobs
@@ -95,6 +96,7 @@ commands =
95 96
 whitelist_externals = mkdir
96 97
 
97 98
 [testenv:releasenotes]
99
+basepython = python3
98 100
 commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
99 101
 
100 102
 [doc8]

Loading…
Cancel
Save