diff options
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | cloudinit/util.py | 2 | ||||
| -rw-r--r-- | tests/unittests/test_datasource/test_azure_helper.py | 2 | ||||
| -rw-r--r-- | tests/unittests/test_datasource/test_smartos.py | 1 | ||||
| -rw-r--r-- | tests/unittests/test_handler/test_handler_power_state.py | 2 | ||||
| -rwxr-xr-x | tools/run-pyflakes | 18 | ||||
| -rwxr-xr-x | tools/run-pyflakes3 | 2 | 
7 files changed, 22 insertions, 6 deletions
| @@ -28,7 +28,6 @@ pyflakes:  pyflakes3:  	@$(CWD)/tools/run-pyflakes3 -  unittest:  	nosetests $(noseopts) tests/unittests  	nosetests3 $(noseopts) tests/unittests diff --git a/cloudinit/util.py b/cloudinit/util.py index de37b0f5..e7407ea4 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2148,7 +2148,7 @@ def _read_dmi_syspath(key):          LOG.debug("dmi data %s returned %s", dmi_key_path, key_data)          return key_data.strip() -    except Exception as e: +    except Exception:          logexc(LOG, "failed read of %s", dmi_key_path)          return None diff --git a/tests/unittests/test_datasource/test_azure_helper.py b/tests/unittests/test_datasource/test_azure_helper.py index 8dbdfb0b..1134199b 100644 --- a/tests/unittests/test_datasource/test_azure_helper.py +++ b/tests/unittests/test_datasource/test_azure_helper.py @@ -1,6 +1,4 @@  import os -import struct -import unittest  from cloudinit.sources.helpers import azure as azure_helper  from ..helpers import TestCase diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py index 5e617b83..616e9f0e 100644 --- a/tests/unittests/test_datasource/test_smartos.py +++ b/tests/unittests/test_datasource/test_smartos.py @@ -31,7 +31,6 @@ import shutil  import stat  import tempfile  import uuid -import unittest  from binascii import crc32  import serial diff --git a/tests/unittests/test_handler/test_handler_power_state.py b/tests/unittests/test_handler/test_handler_power_state.py index f9660ff6..04ce5687 100644 --- a/tests/unittests/test_handler/test_handler_power_state.py +++ b/tests/unittests/test_handler/test_handler_power_state.py @@ -106,7 +106,7 @@ def check_lps_ret(psc_return, mode=None):      if 'shutdown' not in psc_return[0][0]:          errs.append("string 'shutdown' not in cmd") -    if 'condition' is None: +    if condition is None:          errs.append("condition was not returned")      if mode is not None: diff --git a/tools/run-pyflakes b/tools/run-pyflakes new file mode 100755 index 00000000..4bea17f4 --- /dev/null +++ b/tools/run-pyflakes @@ -0,0 +1,18 @@ +#!/bin/bash + +PYTHON_VERSION=${PYTHON_VERSION:-2} +CR=" +" +pycheck_dirs=( "cloudinit/" "bin/" "tests/" "tools/" ) + +set -f +if [ $# -eq 0 ]; then +   files=( "${pycheck_dirs[@]}" ) +else +   files=( "$@" ) +fi + +cmd=( "python${PYTHON_VERSION}" -m "pyflakes" "${files[@]}" ) + +echo "Running: " "${cmd[@]}" 1>&2 +exec "${cmd[@]}" diff --git a/tools/run-pyflakes3 b/tools/run-pyflakes3 new file mode 100755 index 00000000..e9f0863d --- /dev/null +++ b/tools/run-pyflakes3 @@ -0,0 +1,2 @@ +#!/bin/sh +PYTHON_VERSION=3 exec "${0%/*}/run-pyflakes" "$@" | 
