From 4982b93c4ed8963e2e8c193dca3285a8240c41ae Mon Sep 17 00:00:00 2001 From: Bogdan Teleaga Date: Tue, 2 Aug 2016 18:49:29 +0200 Subject: [PATCH] Fixes unit tests on Windows. An exception is being thrown when tests are skipped if the class name starts with Test causing the suite to fail. Changing the name to .*Test fixes the problem. Closes-Bug: #1609782 Change-Id: I8ef761a53737d82f1cf6288a655d014c98407e1c --- oslo_privsep/tests/test_daemon.py | 4 ++-- oslo_privsep/tests/test_priv_context.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/oslo_privsep/tests/test_daemon.py b/oslo_privsep/tests/test_daemon.py index 47e81a1..d7068c3 100644 --- a/oslo_privsep/tests/test_daemon.py +++ b/oslo_privsep/tests/test_daemon.py @@ -63,7 +63,7 @@ class LogTest(testctx.TestContextTestCase): @testtools.skipIf(platform.system() != 'Linux', 'works only on Linux platform.') -class TestDaemon(base.BaseTestCase): +class DaemonTest(base.BaseTestCase): @mock.patch('os.setuid') @mock.patch('os.setgid') @@ -98,7 +98,7 @@ class TestDaemon(base.BaseTestCase): @testtools.skipIf(platform.system() != 'Linux', 'works only on Linux platform.') -class TestWithContext(testctx.TestContextTestCase): +class WithContextTest(testctx.TestContextTestCase): def test_unexported(self): self.assertRaisesRegexp( diff --git a/oslo_privsep/tests/test_priv_context.py b/oslo_privsep/tests/test_priv_context.py index ebf1110..eaddb9f 100644 --- a/oslo_privsep/tests/test_priv_context.py +++ b/oslo_privsep/tests/test_priv_context.py @@ -59,7 +59,7 @@ def fail(custom=False): @testtools.skipIf(platform.system() != 'Linux', 'works only on Linux platform.') -class TestPrivContext(testctx.TestContextTestCase): +class PrivContextTest(testctx.TestContextTestCase): @mock.patch.object(priv_context, 'sys') def test_init_windows(self, mock_sys): @@ -126,7 +126,7 @@ class TestPrivContext(testctx.TestContextTestCase): @testtools.skipIf(platform.system() != 'Linux', 'works only on Linux platform.') -class TestSeparation(testctx.TestContextTestCase): +class SeparationTest(testctx.TestContextTestCase): def test_getpid(self): # Verify that priv_getpid() was executed in another process. priv_pid = priv_getpid() @@ -177,7 +177,7 @@ class RootwrapTest(testctx.TestContextTestCase): @testtools.skipIf(platform.system() != 'Linux', 'works only on Linux platform.') -class TestSerialization(testctx.TestContextTestCase): +class SerializationTest(testctx.TestContextTestCase): def test_basic_functionality(self): self.assertEqual(43, add1(42))