diff options
Diffstat (limited to 'osprofiler/tests')
-rw-r--r-- | osprofiler/tests/unit/cmd/test_shell.py | 10 | ||||
-rw-r--r-- | osprofiler/tests/unit/test_profiler.py | 9 |
2 files changed, 8 insertions, 11 deletions
diff --git a/osprofiler/tests/unit/cmd/test_shell.py b/osprofiler/tests/unit/cmd/test_shell.py index 845d8d9..26be88e 100644 --- a/osprofiler/tests/unit/cmd/test_shell.py +++ b/osprofiler/tests/unit/cmd/test_shell.py @@ -13,13 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +import io import json import os import sys from unittest import mock import ddt -import six from osprofiler.cmd import shell from osprofiler import exc @@ -43,7 +43,7 @@ class ShellTestCase(test.TestCase): cmd = "trace show --connection-string redis:// %s" % self.TRACE_ID return cmd if format_ is None else "%s --%s" % (cmd, format_) - @mock.patch("sys.stdout", six.StringIO()) + @mock.patch("sys.stdout", io.StringIO()) @mock.patch("osprofiler.cmd.shell.OSProfilerShell") def test_shell_main(self, mock_shell): mock_shell.side_effect = exc.CommandError("some_message") @@ -99,7 +99,7 @@ class ShellTestCase(test.TestCase): } return notifications - @mock.patch("sys.stdout", six.StringIO()) + @mock.patch("sys.stdout", io.StringIO()) @mock.patch("osprofiler.drivers.redis_driver.Redis.get_report") def test_trace_show_in_json(self, mock_get): notifications = self._create_mock_notifications() @@ -110,7 +110,7 @@ class ShellTestCase(test.TestCase): separators=(",", ": "),), sys.stdout.getvalue()) - @mock.patch("sys.stdout", six.StringIO()) + @mock.patch("sys.stdout", io.StringIO()) @mock.patch("osprofiler.drivers.redis_driver.Redis.get_report") def test_trace_show_in_html(self, mock_get): notifications = self._create_mock_notifications() @@ -139,7 +139,7 @@ class ShellTestCase(test.TestCase): separators=(",", ": ")), sys.stdout.getvalue()) - @mock.patch("sys.stdout", six.StringIO()) + @mock.patch("sys.stdout", io.StringIO()) @mock.patch("osprofiler.drivers.redis_driver.Redis.get_report") def test_trace_show_write_to_file(self, mock_get): notifications = self._create_mock_notifications() diff --git a/osprofiler/tests/unit/test_profiler.py b/osprofiler/tests/unit/test_profiler.py index 0f0fcb5..ec24046 100644 --- a/osprofiler/tests/unit/test_profiler.py +++ b/osprofiler/tests/unit/test_profiler.py @@ -19,7 +19,6 @@ import datetime import re from unittest import mock -import six from osprofiler import profiler from osprofiler.tests import test @@ -462,7 +461,6 @@ class TraceClsDecoratorTestCase(test.TestCase): # - and FakeTraceStatic.method4 in PY3 "name": "osprofiler.tests.unit.test_profiler" - ".method4" if six.PY2 else "osprofiler.tests.unit.test_profiler.FakeTraceStatic" ".method4", "args": str((25,)), @@ -490,8 +488,7 @@ class TraceClsDecoratorTestCase(test.TestCase): self.assertFalse(mock_stop.called) -@six.add_metaclass(profiler.TracedMeta) -class FakeTraceWithMetaclassBase(object): +class FakeTraceWithMetaclassBase(object, metaclass=profiler.TracedMeta): __trace_args__ = {"name": "rpc", "info": {"a": 10}} @@ -534,8 +531,8 @@ class TraceWithMetaclassTestCase(test.TestCase): def test_no_name_exception(self): def define_class_with_no_name(): - @six.add_metaclass(profiler.TracedMeta) - class FakeTraceWithMetaclassNoName(FakeTracedCls): + class FakeTraceWithMetaclassNoName(FakeTracedCls, + metaclass=profiler.TracedMeta): pass self.assertRaises(TypeError, define_class_with_no_name, 1) |