From a9e564b13fe7df586969711fd3a3d377db7a1c98 Mon Sep 17 00:00:00 2001 From: Nikita Konovalov Date: Tue, 19 Nov 2013 09:33:02 +0400 Subject: [PATCH] Test module refactoring Tests moved inside climate module Change-Id: I619960bd9dc6293980171b510873ef32a5df3ad6 --- climate/{test.py => tests/__init__.py} | 1 + {tests => climate/tests}/db/__init__.py | 0 {tests => climate/tests}/db/sqlalchemy/__init__.py | 0 .../tests}/db/sqlalchemy/test_sqlalchemy_api.py | 4 ++-- {tests => climate/tests}/db/test_api.py | 4 ++-- {tests => climate/tests/inventory}/__init__.py | 0 {tests => climate/tests}/inventory/test_nova.py | 9 +++------ {tests => climate/tests}/test_service.py | 9 +++------ tests/inventory/__init__.py | 0 tests_nova_scheduler/test_climate_scheduler.py | 4 ++-- tox.ini | 2 +- 11 files changed, 14 insertions(+), 19 deletions(-) rename climate/{test.py => tests/__init__.py} (99%) rename {tests => climate/tests}/db/__init__.py (100%) rename {tests => climate/tests}/db/sqlalchemy/__init__.py (100%) rename {tests => climate/tests}/db/sqlalchemy/test_sqlalchemy_api.py (98%) rename {tests => climate/tests}/db/test_api.py (94%) rename {tests => climate/tests/inventory}/__init__.py (100%) rename {tests => climate/tests}/inventory/test_nova.py (90%) rename {tests => climate/tests}/test_service.py (79%) delete mode 100644 tests/inventory/__init__.py diff --git a/climate/test.py b/climate/tests/__init__.py similarity index 99% rename from climate/test.py rename to climate/tests/__init__.py index 05e017e9..41b1d618 100644 --- a/climate/test.py +++ b/climate/tests/__init__.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + import tempfile import fixtures diff --git a/tests/db/__init__.py b/climate/tests/db/__init__.py similarity index 100% rename from tests/db/__init__.py rename to climate/tests/db/__init__.py diff --git a/tests/db/sqlalchemy/__init__.py b/climate/tests/db/sqlalchemy/__init__.py similarity index 100% rename from tests/db/sqlalchemy/__init__.py rename to climate/tests/db/sqlalchemy/__init__.py diff --git a/tests/db/sqlalchemy/test_sqlalchemy_api.py b/climate/tests/db/sqlalchemy/test_sqlalchemy_api.py similarity index 98% rename from tests/db/sqlalchemy/test_sqlalchemy_api.py rename to climate/tests/db/sqlalchemy/test_sqlalchemy_api.py index fd636f1a..80ca02e7 100644 --- a/tests/db/sqlalchemy/test_sqlalchemy_api.py +++ b/climate/tests/db/sqlalchemy/test_sqlalchemy_api.py @@ -18,7 +18,7 @@ import datetime from climate.db.sqlalchemy import api as db_api from climate.openstack.common import context from climate.openstack.common import uuidutils -from climate import test +from climate import tests def _get_fake_random_uuid(): @@ -92,7 +92,7 @@ def _create_physical_lease(values=_get_fake_phys_lease_values(), return db_api.lease_create(values) -class SQLAlchemyDBApiTestCase(test.DBTestCase): +class SQLAlchemyDBApiTestCase(tests.DBTestCase): """Test case for SQLAlchemy DB API.""" def setUp(self): diff --git a/tests/db/test_api.py b/climate/tests/db/test_api.py similarity index 94% rename from tests/db/test_api.py rename to climate/tests/db/test_api.py index 25c89948..1cb4bda7 100644 --- a/tests/db/test_api.py +++ b/climate/tests/db/test_api.py @@ -14,10 +14,10 @@ # limitations under the License. from climate.db import api as db_api -from climate import test +from climate import tests -class DBApiTestCase(test.TestCase): +class DBApiTestCase(tests.TestCase): """Test case for DB API.""" # TODO(sbauza) : Extend methods to CRUD lease diff --git a/tests/__init__.py b/climate/tests/inventory/__init__.py similarity index 100% rename from tests/__init__.py rename to climate/tests/inventory/__init__.py diff --git a/tests/inventory/test_nova.py b/climate/tests/inventory/test_nova.py similarity index 90% rename from tests/inventory/test_nova.py rename to climate/tests/inventory/test_nova.py index 3c345a57..4cbfa20c 100644 --- a/tests/inventory/test_nova.py +++ b/climate/tests/inventory/test_nova.py @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- -# -# Copyright © 2013 Julien Danjou +# Copyright (c) 2013 Julien Danjou # # 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 @@ -18,10 +15,10 @@ import mock from climate.inventory import nova -from climate import test +from climate import tests -class ServiceTestCase(test.TestCase): +class ServiceTestCase(tests.TestCase): """This test class should be removed, but is kept as an example for unit testing. """ diff --git a/tests/test_service.py b/climate/tests/test_service.py similarity index 79% rename from tests/test_service.py rename to climate/tests/test_service.py index e96d2184..86fa8f98 100644 --- a/tests/test_service.py +++ b/climate/tests/test_service.py @@ -1,7 +1,4 @@ -#!/usr/bin/env python -# -*- encoding: utf-8 -*- -# -# Copyright © 2013 Julien Danjou +# Copyright (c) 2013 Julien Danjou # # 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 @@ -15,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from climate import test +from climate import tests from climate.utils import service -class ServiceTestCase(test.TestCase): +class ServiceTestCase(tests.TestCase): def test_prepare_service(self): service.prepare_service() diff --git a/tests/inventory/__init__.py b/tests/inventory/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests_nova_scheduler/test_climate_scheduler.py b/tests_nova_scheduler/test_climate_scheduler.py index df11d810..3ccfc9d4 100644 --- a/tests_nova_scheduler/test_climate_scheduler.py +++ b/tests_nova_scheduler/test_climate_scheduler.py @@ -18,10 +18,10 @@ from nova.tests.scheduler import fakes from climate.nova import climate_filter -from climate import test +from climate import tests -class ClimateSchedulerTestCase(test.TestCase): +class ClimateSchedulerTestCase(tests.TestCase): def test_climate_scheduler(self): f = climate_filter.ClimateFilter() diff --git a/tox.ini b/tox.ini index 9f5dc4c8..70a90784 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ setenv = VIRTUAL_ENV={envdir} NOSE_OPENSTACK_YELLOW=0.025 NOSE_OPENSTACK_SHOW_ELAPSED=1 commands = nosetests --no-path-adjustment --where=tests_nova_scheduler - nosetests --no-path-adjustment --where=tests {posargs} + nosetests --no-path-adjustment --where=climate/tests {posargs} sitepackages = False [testenv:cover]