← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:cleanup/remove-json-schema-from-tox-xenial into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:cleanup/remove-json-schema-from-tox-xenial into cloud-init:master.

Commit message:
tests: remove jsonschema from tox environment.

Add the helper tools/pipremove that removes pip packages.
Then use that to remove jsonschema without noise of always
running and ignoring a 'pip uninstall jsonschema'.

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/341995
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:cleanup/remove-json-schema-from-tox-xenial into cloud-init:master.
diff --git a/tools/pipremove b/tools/pipremove
new file mode 100755
index 0000000..f8f4ff1
--- /dev/null
+++ b/tools/pipremove
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+import subprocess
+import sys
+
+for pkg in sys.argv[1:]:
+    try:
+        exec('import %s' % pkg)  # pylint: disable=W0122
+    except ImportError:
+        continue
+    sys.stderr.write("%s removing package %s\n" % (sys.argv[0], pkg))
+    ret = subprocess.Popen(['pip', 'uninstall', '--yes', pkg]).wait()
+    if ret != 0:
+        sys.stderr.write("Failed to uninstall %s (%d)\n" % (pkg, ret))
+        sys.exit(ret)
diff --git a/tox.ini b/tox.ini
index 1f990af..818ade3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -60,6 +60,9 @@ deps = sphinx
 commands = {envpython} -m sphinx {posargs:doc/rtd doc/rtd_html}
 
 [testenv:xenial]
+commands =
+  python ./tools/pipremove jsonschema
+  python -m nose {posargs:tests/unittests cloudinit}
 basepython = python3
 deps =
     # requirements