CORD-1939 support for nose2
modify test cases to be compliant with automation
Change-Id: Iddb3803b71d027010e4df00efd2ed8ba671efbd7
diff --git a/lib/__init__.py b/lib/__init__.py
new file mode 100644
index 0000000..42722a8
--- /dev/null
+++ b/lib/__init__.py
@@ -0,0 +1,14 @@
+
+# Copyright 2017-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.
diff --git a/lib/xos-config/tests/config_test.py b/lib/xos-config/tests/test_config.py
similarity index 92%
rename from lib/xos-config/tests/config_test.py
rename to lib/xos-config/tests/test_config.py
index a3a89de..714936c 100644
--- a/lib/xos-config/tests/config_test.py
+++ b/lib/xos-config/tests/test_config.py
@@ -52,6 +52,10 @@
Testing the XOS Config Module
"""
+ def setUp(self):
+ # In case some other testcase in nose has left config in an unclean state
+ Config.clear()
+
def tearDown(self):
# NOTE clear the config after each test
Config.clear()
@@ -143,10 +147,24 @@
Config.init(basic_conf)
log = Config.get("logging")
self.assertEqual(log, {
- "level": "info",
- "channels": ["file", "console"],
- "logstash_hostport": "cordloghost:5617",
- "file": "/var/log/xos.log",
+ 'version': 1,
+ 'handlers': {
+ 'console': {
+ 'class': 'logging.StreamHandler',
+ },
+ 'file': {
+ 'class': 'logging.handlers.RotatingFileHandler',
+ 'filename': '/var/log/xos.log',
+ 'maxBytes': 10485760,
+ 'backupCount': 5
+ }
+ },
+ 'loggers': {
+ '': {
+ 'handlers': ['console', 'file'],
+ 'level': 'DEBUG'
+ }
+ }
})
def test_get_config_file(self):
diff --git a/lib/xos-config/xosconfig/__init__.py b/lib/xos-config/xosconfig/__init__.py
index b7ad3d8..105d4a0 100644
--- a/lib/xos-config/xosconfig/__init__.py
+++ b/lib/xos-config/xosconfig/__init__.py
@@ -14,4 +14,4 @@
# limitations under the License.
-from .config import Config
\ No newline at end of file
+from .config import Config
diff --git a/lib/xos-genx/tests/__init__.py b/lib/xos-genx/xos-genx-tests/__init__.py
similarity index 100%
rename from lib/xos-genx/tests/__init__.py
rename to lib/xos-genx/xos-genx-tests/__init__.py
diff --git a/lib/xos-genx/tests/attics/xosmodel_bottom.py b/lib/xos-genx/xos-genx-tests/attics/xosmodel_bottom.py
similarity index 100%
rename from lib/xos-genx/tests/attics/xosmodel_bottom.py
rename to lib/xos-genx/xos-genx-tests/attics/xosmodel_bottom.py
diff --git a/lib/xos-genx/tests/attics/xosmodel_header.py b/lib/xos-genx/xos-genx-tests/attics/xosmodel_header.py
similarity index 100%
rename from lib/xos-genx/tests/attics/xosmodel_header.py
rename to lib/xos-genx/xos-genx-tests/attics/xosmodel_header.py
diff --git a/lib/xos-genx/tests/attics/xosmodel_model.py b/lib/xos-genx/xos-genx-tests/attics/xosmodel_model.py
similarity index 100%
rename from lib/xos-genx/tests/attics/xosmodel_model.py
rename to lib/xos-genx/xos-genx-tests/attics/xosmodel_model.py
diff --git a/lib/xos-genx/tests/attics/xosmodel_top.py b/lib/xos-genx/xos-genx-tests/attics/xosmodel_top.py
similarity index 100%
rename from lib/xos-genx/tests/attics/xosmodel_top.py
rename to lib/xos-genx/xos-genx-tests/attics/xosmodel_top.py
diff --git a/lib/xos-genx/tests/counts b/lib/xos-genx/xos-genx-tests/counts
similarity index 100%
rename from lib/xos-genx/tests/counts
rename to lib/xos-genx/xos-genx-tests/counts
diff --git a/lib/xos-genx/tests/django_generator_test.py b/lib/xos-genx/xos-genx-tests/django_generator_test.py
similarity index 100%
rename from lib/xos-genx/tests/django_generator_test.py
rename to lib/xos-genx/xos-genx-tests/django_generator_test.py
diff --git a/lib/xos-genx/tests/field_graph_test.py b/lib/xos-genx/xos-genx-tests/field_graph_test.py
similarity index 100%
rename from lib/xos-genx/tests/field_graph_test.py
rename to lib/xos-genx/xos-genx-tests/field_graph_test.py
diff --git a/lib/xos-genx/tests/general_security_test.py b/lib/xos-genx/xos-genx-tests/general_security_test.py
similarity index 100%
rename from lib/xos-genx/tests/general_security_test.py
rename to lib/xos-genx/xos-genx-tests/general_security_test.py
diff --git a/lib/xos-genx/tests/general_validation_test.py b/lib/xos-genx/xos-genx-tests/general_validation_test.py
similarity index 100%
rename from lib/xos-genx/tests/general_validation_test.py
rename to lib/xos-genx/xos-genx-tests/general_validation_test.py
diff --git a/lib/xos-genx/tests/graph_test.py b/lib/xos-genx/xos-genx-tests/graph_test.py
similarity index 100%
rename from lib/xos-genx/tests/graph_test.py
rename to lib/xos-genx/xos-genx-tests/graph_test.py
diff --git a/lib/xos-genx/tests/helpers.py b/lib/xos-genx/xos-genx-tests/helpers.py
similarity index 100%
rename from lib/xos-genx/tests/helpers.py
rename to lib/xos-genx/xos-genx-tests/helpers.py
diff --git a/lib/xos-genx/tests/optimize_test.py b/lib/xos-genx/xos-genx-tests/optimize_test.py
similarity index 100%
rename from lib/xos-genx/tests/optimize_test.py
rename to lib/xos-genx/xos-genx-tests/optimize_test.py
diff --git a/lib/xos-genx/tests/out/.gitignore b/lib/xos-genx/xos-genx-tests/out/.gitignore
similarity index 100%
rename from lib/xos-genx/tests/out/.gitignore
rename to lib/xos-genx/xos-genx-tests/out/.gitignore
diff --git a/lib/xos-genx/tests/package_test.py b/lib/xos-genx/xos-genx-tests/package_test.py
similarity index 100%
rename from lib/xos-genx/tests/package_test.py
rename to lib/xos-genx/xos-genx-tests/package_test.py
diff --git a/lib/xos-genx/tests/parse_test.py b/lib/xos-genx/xos-genx-tests/parse_test.py
similarity index 100%
rename from lib/xos-genx/tests/parse_test.py
rename to lib/xos-genx/xos-genx-tests/parse_test.py
diff --git a/lib/xos-genx/tests/policy_test.py b/lib/xos-genx/xos-genx-tests/policy_test.py
similarity index 100%
rename from lib/xos-genx/tests/policy_test.py
rename to lib/xos-genx/xos-genx-tests/policy_test.py
diff --git a/lib/xos-genx/tests/pure_proto_test.py b/lib/xos-genx/xos-genx-tests/pure_proto_test.py
similarity index 100%
rename from lib/xos-genx/tests/pure_proto_test.py
rename to lib/xos-genx/xos-genx-tests/pure_proto_test.py
diff --git a/lib/xos-genx/tests/rlinks_test.py b/lib/xos-genx/xos-genx-tests/rlinks_test.py
similarity index 100%
rename from lib/xos-genx/tests/rlinks_test.py
rename to lib/xos-genx/xos-genx-tests/rlinks_test.py
diff --git a/lib/xos-genx/tests/swagger_test.py b/lib/xos-genx/xos-genx-tests/swagger_test.py
similarity index 100%
rename from lib/xos-genx/tests/swagger_test.py
rename to lib/xos-genx/xos-genx-tests/swagger_test.py
diff --git a/lib/xos-genx/tests/target_test.py b/lib/xos-genx/xos-genx-tests/target_test.py
similarity index 100%
rename from lib/xos-genx/tests/target_test.py
rename to lib/xos-genx/xos-genx-tests/target_test.py
diff --git a/lib/xos-genx/tests/test_cli.py b/lib/xos-genx/xos-genx-tests/test_cli.py
similarity index 89%
rename from lib/xos-genx/tests/test_cli.py
rename to lib/xos-genx/xos-genx-tests/test_cli.py
index 89935bc..29098f1 100644
--- a/lib/xos-genx/tests/test_cli.py
+++ b/lib/xos-genx/xos-genx-tests/test_cli.py
@@ -32,9 +32,9 @@
[XOS-GenX] The CLI entry point should correctly parse params
"""
args = Args()
- args.files = ['tests/xproto/test.xproto']
- args.target = 'tests/xtarget/test.xtarget'
- args.output = 'tests/out/dir/'
+ args.files = ['lib/xos-genx/xos-genx-tests/xproto/test.xproto']
+ args.target = 'lib/xos-genx/xos-genx-tests/xtarget/test.xtarget'
+ args.output = 'lib/xos-genx/xos-genx-tests/out/dir/'
args.write_to_file = "target"
args.dest_file = None
args.dest_extension = None
diff --git a/lib/xos-genx/tests/test_generator.py b/lib/xos-genx/xos-genx-tests/test_generator.py
similarity index 98%
rename from lib/xos-genx/tests/test_generator.py
rename to lib/xos-genx/xos-genx-tests/test_generator.py
index 0e7e337..f59bbfd 100644
--- a/lib/xos-genx/tests/test_generator.py
+++ b/lib/xos-genx/xos-genx-tests/test_generator.py
@@ -45,6 +45,7 @@
"""
def setUp(self):
+ os.chdir(os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(__file__))), ".."))
filesToRemove = [f for f in os.listdir(OUTPUT_DIR)]
for f in filesToRemove:
if not f.startswith('.'):
diff --git a/lib/xos-genx/tests/tosca_test.py b/lib/xos-genx/xos-genx-tests/tosca_test.py
similarity index 100%
rename from lib/xos-genx/tests/tosca_test.py
rename to lib/xos-genx/xos-genx-tests/tosca_test.py
diff --git a/lib/xos-genx/tests/translator_test.py b/lib/xos-genx/xos-genx-tests/translator_test.py
similarity index 100%
rename from lib/xos-genx/tests/translator_test.py
rename to lib/xos-genx/xos-genx-tests/translator_test.py
diff --git a/lib/xos-genx/tests/xos_security_test.py b/lib/xos-genx/xos-genx-tests/xos_security_test.py
similarity index 100%
rename from lib/xos-genx/tests/xos_security_test.py
rename to lib/xos-genx/xos-genx-tests/xos_security_test.py
diff --git a/lib/xos-genx/tests/xos_validation_test.py b/lib/xos-genx/xos-genx-tests/xos_validation_test.py
similarity index 100%
rename from lib/xos-genx/tests/xos_validation_test.py
rename to lib/xos-genx/xos-genx-tests/xos_validation_test.py
diff --git a/lib/xos-genx/tests/xproto/base.xproto b/lib/xos-genx/xos-genx-tests/xproto/base.xproto
similarity index 100%
rename from lib/xos-genx/tests/xproto/base.xproto
rename to lib/xos-genx/xos-genx-tests/xproto/base.xproto
diff --git a/lib/xos-genx/tests/xproto/skip_django.xproto b/lib/xos-genx/xos-genx-tests/xproto/skip_django.xproto
similarity index 100%
rename from lib/xos-genx/tests/xproto/skip_django.xproto
rename to lib/xos-genx/xos-genx-tests/xproto/skip_django.xproto
diff --git a/lib/xos-genx/tests/xproto/test.xproto b/lib/xos-genx/xos-genx-tests/xproto/test.xproto
similarity index 100%
rename from lib/xos-genx/tests/xproto/test.xproto
rename to lib/xos-genx/xos-genx-tests/xproto/test.xproto
diff --git a/lib/xos-genx/tests/xproto/vrouterport.xproto b/lib/xos-genx/xos-genx-tests/xproto/vrouterport.xproto
similarity index 100%
rename from lib/xos-genx/tests/xproto/vrouterport.xproto
rename to lib/xos-genx/xos-genx-tests/xproto/vrouterport.xproto
diff --git a/lib/xos-genx/tests/xtarget/split.xtarget b/lib/xos-genx/xos-genx-tests/xtarget/split.xtarget
similarity index 100%
rename from lib/xos-genx/tests/xtarget/split.xtarget
rename to lib/xos-genx/xos-genx-tests/xtarget/split.xtarget
diff --git a/lib/xos-genx/tests/xtarget/test.xtarget b/lib/xos-genx/xos-genx-tests/xtarget/test.xtarget
similarity index 100%
rename from lib/xos-genx/tests/xtarget/test.xtarget
rename to lib/xos-genx/xos-genx-tests/xtarget/test.xtarget