summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--cloudinit/sources/DataSourceOVF.py3
-rw-r--r--cloudinit/sources/helpers/vmware/imc/config_nic.py1
-rw-r--r--cloudinit/util.py2
-rwxr-xr-xpackages/debian/rules.in2
-rw-r--r--tests/unittests/test_datasource/test_azure_helper.py2
-rw-r--r--tests/unittests/test_datasource/test_smartos.py1
-rw-r--r--tests/unittests/test_handler/test_handler_power_state.py2
-rw-r--r--tox.ini6
9 files changed, 16 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index bb0c5253..a7fa5a3b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
CWD=$(shell pwd)
PY_FILES=$(shell find cloudinit bin tests tools -name "*.py" -type f )
PY_FILES+="bin/cloud-init"
+noseopts ?= -v
YAML_FILES=$(shell find cloudinit bin tests tools -name "*.yaml" -type f )
YAML_FILES+=$(shell find doc/examples -name "cloud-config*.txt" -type f )
@@ -14,13 +15,15 @@ ifeq ($(distro),)
distro = redhat
endif
-all: test check_version
+all: check
+
+check: test check_version pyflakes
pep8:
@$(CWD)/tools/run-pep8 $(PY_FILES)
pyflakes:
- @$(CWD)/tools/tox-venv py34 pyflakes $(PY_FILES)
+ @pyflakes $(PY_FILES)
pip-requirements:
@echo "Installing cloud-init dependencies..."
@@ -31,8 +34,7 @@ pip-test-requirements:
$(PIP_INSTALL) -r "$@.txt" -q
test: clean_pyc
- @echo "Running tests..."
- @nosetests $(noseopts) tests/
+ @n=$$(which nosetests3) || n=nosetests; set -- $$n $(noseopts) tests/; echo "Running $$*"; "$$@"
check_version:
@if [ "$(CHANGELOG_VERSION)" != "$(CODE_VERSION)" ]; then \
diff --git a/cloudinit/sources/DataSourceOVF.py b/cloudinit/sources/DataSourceOVF.py
index 72ba5aba..d12601a4 100644
--- a/cloudinit/sources/DataSourceOVF.py
+++ b/cloudinit/sources/DataSourceOVF.py
@@ -90,7 +90,8 @@ class DataSourceOVF(sources.DataSource):
nicConfigurator.configure()
vmwarePlatformFound = True
except Exception as inst:
- LOG.debug("Error while parsing the Customization Config File")
+ LOG.debug("Error while parsing the Customization "
+ "Config File: %s", inst)
finally:
dirPath = os.path.dirname(vmwareImcConfigFilePath)
shutil.rmtree(dirPath)
diff --git a/cloudinit/sources/helpers/vmware/imc/config_nic.py b/cloudinit/sources/helpers/vmware/imc/config_nic.py
index 172a1649..6d721134 100644
--- a/cloudinit/sources/helpers/vmware/imc/config_nic.py
+++ b/cloudinit/sources/helpers/vmware/imc/config_nic.py
@@ -19,7 +19,6 @@
import logging
import os
-import subprocess
import re
from cloudinit import util
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 45d49e66..0a639bb9 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2147,7 +2147,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/packages/debian/rules.in b/packages/debian/rules.in
index bb2e1d5c..d6cd23ae 100755
--- a/packages/debian/rules.in
+++ b/packages/debian/rules.in
@@ -16,4 +16,4 @@ override_dh_install:
override_dh_auto_test:
# Because setup tools didn't copy data...
[ ! -d .pybuild/pythonX.Y_?.?/build/tests ] || cp -r tests/data .pybuild/pythonX.Y_?.?/build/tests
- http_proxy= dh_auto_test -- --test-nose
+ http_proxy= make check
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 1235436d..ccb9f080 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 5687b10d..cd376e9c 100644
--- a/tests/unittests/test_handler/test_handler_power_state.py
+++ b/tests/unittests/test_handler/test_handler_power_state.py
@@ -107,7 +107,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/tox.ini b/tox.ini
index b72df0c9..fd65f6ef 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27,py3
+envlist = py27,py3,pyflakes
recreate = True
[testenv]
@@ -10,6 +10,10 @@ deps = -r{toxinidir}/test-requirements.txt
[testenv:py3]
basepython = python3
+[testenv:pyflakes]
+basepython = python3
+commands = {envpython} -m pyflakes {posargs:cloudinit/ tests/ tools/}
+
# https://github.com/gabrielfalcao/HTTPretty/issues/223
setenv =
LC_ALL = en_US.utf-8