From f7556744bb5ef3f06845ec4cc044efb9b9f0eb82 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Fri, 15 Sep 2017 17:12:03 -0400 Subject: [PATCH] Bump minimum os-testr requirement to 1.0.0 This commit bumps the os-testr version to use 1.0.0. 1.0.0 changes the internals to use stestr instead of subprocessing testr. A bunch of incorrect imports in the tests were updated as a well, relying on relative import paths is finicky at the best of times so to make the tests work this just points to the path based on the root of the package instead. Change-Id: I2aed3f6a9adeac2b7dbe58ee12c0a1485278d56f --- .gitignore | 1 + .stestr.conf | 2 ++ storyboard/tests/plugin/email/test_base.py | 2 +- storyboard/tests/plugin/email/test_factory.py | 16 ++++++++-------- .../tests/plugin/email/test_smtp_client.py | 2 +- storyboard/tests/plugin/scheduler/test_base.py | 5 +++-- storyboard/tests/plugin/scheduler/test_init.py | 3 +-- test-requirements.txt | 2 +- tox.ini | 3 +++ 9 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 .stestr.conf diff --git a/.gitignore b/.gitignore index bf1d38ab..42dc7991 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ pip-log.txt nosetests.xml .coverage .tox +.stestr/ .testrepository .venv diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 00000000..29702069 --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,2 @@ +[DEFAULT] +test_path=./storyboard/tests diff --git a/storyboard/tests/plugin/email/test_base.py b/storyboard/tests/plugin/email/test_base.py index be347d65..732da401 100644 --- a/storyboard/tests/plugin/email/test_base.py +++ b/storyboard/tests/plugin/email/test_base.py @@ -19,9 +19,9 @@ import stat from oslo_config import cfg -import mock_smtp as mock from storyboard.plugin.email.base import EmailPluginBase from storyboard.tests import base +from storyboard.tests import mock_smtp as mock CONF = cfg.CONF diff --git a/storyboard/tests/plugin/email/test_factory.py b/storyboard/tests/plugin/email/test_factory.py index a740348b..b4fcc589 100644 --- a/storyboard/tests/plugin/email/test_factory.py +++ b/storyboard/tests/plugin/email/test_factory.py @@ -28,7 +28,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') msg = factory.build('test_recipient@example.org', test_parameter='value') @@ -60,7 +60,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') custom_headers = { 'X-Custom-Header': 'test-header-value' } @@ -85,7 +85,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') msg = factory.build('test_recipient@example.org', test_parameter='value') self.assertEqual('value', msg.get('Subject')) @@ -94,7 +94,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_long_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') msg = factory.build('test_recipient@example.org', test_parameter='value') self.assertEqual(78, len(msg.get('Subject'))) @@ -104,7 +104,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject_newline.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') msg = factory.build('test_recipient@example.org', test_parameter='value') self.assertEqual('with newline', msg.get('Subject')) @@ -117,7 +117,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') factory.add_text_template('test.html', 'html') msg = factory.build('test_recipient@example.org', @@ -147,7 +147,7 @@ class TestEmailFactory(base.TestCase): EmailFactory('test@example.org', 'invalid_subject.txt', 'invalid.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') self.assertFalse(True) except TemplateNotFound: self.assertFalse(False) @@ -156,7 +156,7 @@ class TestEmailFactory(base.TestCase): factory = EmailFactory('test@example.org', 'test_subject.txt', 'test.txt', - 'plugin.email') + 'storyboard.tests.plugin.email') factory.add_text_template('invalid.html', 'html') self.assertFalse(True) except TemplateNotFound: diff --git a/storyboard/tests/plugin/email/test_smtp_client.py b/storyboard/tests/plugin/email/test_smtp_client.py index 8beac631..ad0012d7 100644 --- a/storyboard/tests/plugin/email/test_smtp_client.py +++ b/storyboard/tests/plugin/email/test_smtp_client.py @@ -14,9 +14,9 @@ from oslo_config import cfg -import mock_smtp as mock from storyboard.plugin.email.smtp_client import get_smtp_client from storyboard.tests import base +from storyboard.tests import mock_smtp as mock CONF = cfg.CONF diff --git a/storyboard/tests/plugin/scheduler/test_base.py b/storyboard/tests/plugin/scheduler/test_base.py index dc9c21d1..fd45eaa5 100644 --- a/storyboard/tests/plugin/scheduler/test_base.py +++ b/storyboard/tests/plugin/scheduler/test_base.py @@ -22,8 +22,9 @@ class TestSchedulerBasePlugin(base.TestCase): def test_plugin_name(self): plugin = TestPlugin(dict()) - self.assertEqual("plugin.scheduler.test_base:TestPlugin", - plugin.get_name()) + self.assertEqual( + "storyboard.tests.plugin.scheduler.test_base:TestPlugin", + plugin.get_name()) class TestPlugin(SchedulerPluginBase): diff --git a/storyboard/tests/plugin/scheduler/test_init.py b/storyboard/tests/plugin/scheduler/test_init.py index 49f49894..f5238bab 100644 --- a/storyboard/tests/plugin/scheduler/test_init.py +++ b/storyboard/tests/plugin/scheduler/test_init.py @@ -20,11 +20,10 @@ from apscheduler.triggers.interval import IntervalTrigger from oslo_config import cfg from stevedore.extension import Extension -from plugin.scheduler.mock_plugin import MockPlugin - from storyboard.plugin.base import StoryboardPluginLoader import storyboard.plugin.scheduler as scheduler import storyboard.tests.base as base +from storyboard.tests.plugin.scheduler.mock_plugin import MockPlugin CONF = cfg.CONF diff --git a/test-requirements.txt b/test-requirements.txt index af60841d..bf8a3fe3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,7 @@ mock>=1.0 python-subunit oslo.sphinx oslotest>=1.2.0 -os-testr==0.8.2 +os-testr>=1.0.0 testrepository>=0.0.18 testscenarios>=0.4,<0.5 testtools>=0.9.34 diff --git a/tox.ini b/tox.ini index 2dc81578..1e4356ec 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,9 @@ usedevelop = True install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} + OS_STDERR_CAPTURE=1 + OS_STDOUT_CAPTURE=1 + OS_TEST_TIMEOUT=60 passenv = OS_TEST_TIMEOUT deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt