From 12f569bdd76f94f349da5d59c4e34ed9165fd5ce Mon Sep 17 00:00:00 2001 From: Kota Tsuyuzaki Date: Wed, 22 Feb 2017 05:11:27 -0800 Subject: [PATCH] Add __init__ to run ostestr for the dir It looks like we need packaging (i.e. __init__.py) for each test dir otherwise the tests in the dirs is not running on the tox (our gate too!). And fix some broken import from package refactoring. Trivial-Fix Change-Id: Ic800c96a8cecadf43797f3df5a58d60a8c9bdf22 --- tests/unit/agent/storlet_daemon/__init__.py | 0 tests/unit/agent/storlet_daemon/test_daemon.py | 17 +++++++++-------- tests/unit/tools/extensions/__init__.py | 0 3 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 tests/unit/agent/storlet_daemon/__init__.py create mode 100644 tests/unit/tools/extensions/__init__.py diff --git a/tests/unit/agent/storlet_daemon/__init__.py b/tests/unit/agent/storlet_daemon/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/agent/storlet_daemon/test_daemon.py b/tests/unit/agent/storlet_daemon/test_daemon.py index 5a3149bf..1b29a0b8 100644 --- a/tests/unit/agent/storlet_daemon/test_daemon.py +++ b/tests/unit/agent/storlet_daemon/test_daemon.py @@ -15,13 +15,13 @@ import unittest import eventlet import mock -from storlet_daemon.daemon import ( +from storlets.agent.daemon.manager import ( Daemon, EXIT_SUCCESS, StorletDaemonException) -from sbus.datagram import FDMetadata, SBusServiceDatagram -from sbus.file_description import SBUS_FD_SERVICE_OUT -import sbus.command +from storlets.sbus.datagram import FDMetadata, SBusServiceDatagram +from storlets.sbus.file_description import SBUS_FD_SERVICE_OUT +import storlets.sbus.command -from tests.unit.swift import FakeLogger +from tests.unit import FakeLogger class FakeModule(object): @@ -110,7 +110,8 @@ class TestStorletDaemon(unittest.TestCase): ] fake_sbus_class = create_fake_sbus_class(scenario) - with mock.patch('storlet_daemon.daemon.SBus', fake_sbus_class): + with mock.patch( + 'storlets.agent.daemon.manager.SBus', fake_sbus_class): with mock.patch('os.fdopen'): self.pile.spawn(daemon.main_loop) eventlet.sleep() @@ -124,14 +125,14 @@ class TestStorletDaemon(unittest.TestCase): def test_main_loop_successful_stop(self): # SBUS_CMD_HALT is for working to stop requested from # storlet_middleware - self._test_main_loop_stop(sbus.command.SBUS_CMD_HALT) + self._test_main_loop_stop(storlets.sbus.command.SBUS_CMD_HALT) def test_main_loop_canceled_stop(self): # SBUS_CMD_CANCEL is for working to stop from sort of daemon # management tools # TODO(kota_): SBUS_CMD_CANCEL has more tasks to do for cleanup # so need more assertions. - self._test_main_loop_stop(sbus.command.SBUS_CMD_CANCEL) + self._test_main_loop_stop(storlets.sbus.command.SBUS_CMD_CANCEL) if __name__ == '__main__': diff --git a/tests/unit/tools/extensions/__init__.py b/tests/unit/tools/extensions/__init__.py new file mode 100644 index 00000000..e69de29b