[SEBA-450] (part 1)
Refactoring, python3 compat, and tox tests on:
- xosconfig
- xosgenx
- xosutil
Eliminate use of yaml.load() which is unsafe, switch to yaml.safe_load()
More diagnostics during database migration
Change-Id: I0fae5782fca401603a7c4e4ec2b9269ad24bda97
diff --git a/lib/xos-util/.gitignore b/lib/xos-util/.gitignore
index 7fa3589..02a3a55 100644
--- a/lib/xos-util/.gitignore
+++ b/lib/xos-util/.gitignore
@@ -1,6 +1 @@
-build
-dist
-XosUtil.egg-info
-.coverage
-coverage.xml
-cover
\ No newline at end of file
+tests/test_version.py
diff --git a/lib/xos-util/setup.py b/lib/xos-util/setup.py
index a3707ef..a542cb9 100644
--- a/lib/xos-util/setup.py
+++ b/lib/xos-util/setup.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
from xosutil.autoversion_setup import setup_with_auto_version
from xosutil.version import __version__
diff --git a/lib/xos-util/tests/test_util.py b/lib/xos-util/tests/test_util.py
index 2b5be07..f4c0d3a 100644
--- a/lib/xos-util/tests/test_util.py
+++ b/lib/xos-util/tests/test_util.py
@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
+
import os
import unittest
diff --git a/lib/xos-util/tox.ini b/lib/xos-util/tox.ini
new file mode 100644
index 0000000..2e1275a
--- /dev/null
+++ b/lib/xos-util/tox.ini
@@ -0,0 +1,42 @@
+; Copyright 2019-present Open Networking Foundation
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+[tox]
+envlist = py27,py35,py36,py37
+skip_missing_interpreters = true
+
+[testenv]
+deps =
+ nose2
+ flake8
+
+commands =
+ nose2 -c tox.ini --verbose --junit-xml
+ flake8
+
+[flake8]
+max-line-length = 119
+
+[unittest]
+plugins=nose2.plugins.junitxml
+
+[junit-xml]
+path=nose2-results.xml
+
+[coverage]
+always-on = True
+coverage = xosutil
+coverage-report =
+ xml
+ term
diff --git a/lib/xos-util/xosutil/autodiscover_version.py b/lib/xos-util/xosutil/autodiscover_version.py
index 8f4ea47..2a74273 100644
--- a/lib/xos-util/xosutil/autodiscover_version.py
+++ b/lib/xos-util/xosutil/autodiscover_version.py
@@ -20,6 +20,8 @@
of the caller.
"""
+from __future__ import absolute_import
+
import inspect
import os
diff --git a/lib/xos-util/xosutil/autoversion_setup.py b/lib/xos-util/xosutil/autoversion_setup.py
index e027d5c..a0f30f0 100644
--- a/lib/xos-util/xosutil/autoversion_setup.py
+++ b/lib/xos-util/xosutil/autoversion_setup.py
@@ -23,14 +23,16 @@
automatically load the version number from the VERSION file, if one is detected.
"""
-import os
-from setuptools import setup
-
-from setuptools.command.sdist import sdist
-from setuptools.command.build_py import build_py
+from __future__ import absolute_import
import inspect
-from autodiscover_version import autodiscover_version
+import os
+
+from setuptools import setup
+from setuptools.command.build_py import build_py
+from setuptools.command.sdist import sdist
+
+from .autodiscover_version import autodiscover_version
class SdistCommand(sdist):