diff options
author | Roger Meier <r.meier@siemens.com> | 2019-12-18 15:36:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-18 15:36:42 +0100 |
commit | 5fa0e162f561451f7fa487dc4a4ff265c1d37f79 (patch) | |
tree | 8890d5767a89adfd412a92e2a9e7d211c5048769 /gitlab/tests | |
parent | 5a10eb3af52a8619d446616196dd3c0c3b91c395 (diff) | |
parent | c817dccde8c104dcb294bbf1590c7e3ae9539466 (diff) | |
download | gitlab-5fa0e162f561451f7fa487dc4a4ff265c1d37f79.tar.gz |
Merge pull request #980 from python-gitlab/refactor/cleanup-upgrade
Refactor/cleanup upgrade
Diffstat (limited to 'gitlab/tests')
-rw-r--r-- | gitlab/tests/test_cli.py | 7 | ||||
-rw-r--r-- | gitlab/tests/test_config.py | 22 |
2 files changed, 14 insertions, 15 deletions
diff --git a/gitlab/tests/test_cli.py b/gitlab/tests/test_cli.py index 04a1961..4820103 100644 --- a/gitlab/tests/test_cli.py +++ b/gitlab/tests/test_cli.py @@ -20,6 +20,7 @@ import argparse import os import tempfile import unittest +import io try: from contextlib import redirect_stderr # noqa: H302 @@ -34,8 +35,6 @@ except ImportError: sys.stderr = old_target -import six - from gitlab import cli import gitlab.v4.cli @@ -56,7 +55,7 @@ class TestCLI(unittest.TestCase): self.assertEqual("class", cli.cls_to_what(Class)) def test_die(self): - fl = six.StringIO() + fl = io.StringIO() with redirect_stderr(fl): with self.assertRaises(SystemExit) as test: cli.die("foobar") @@ -83,7 +82,7 @@ class TestCLI(unittest.TestCase): self.assertEqual(ret, "content") os.unlink(temp_path) - fl = six.StringIO() + fl = io.StringIO() with redirect_stderr(fl): with self.assertRaises(SystemExit) as exc: cli._parse_value("@/thisfileprobablydoesntexist") diff --git a/gitlab/tests/test_config.py b/gitlab/tests/test_config.py index a43f977..65bd300 100644 --- a/gitlab/tests/test_config.py +++ b/gitlab/tests/test_config.py @@ -18,7 +18,7 @@ import unittest import mock -import six +import io from gitlab import config @@ -80,16 +80,16 @@ class TestConfigParser(unittest.TestCase): config.GitlabConfigParser("test") @mock.patch("os.path.exists") - @mock.patch("six.moves.builtins.open") + @mock.patch("builtins.open") def test_invalid_id(self, m_open, path_exists): - fd = six.StringIO(no_default_config) + fd = io.StringIO(no_default_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd path_exists.return_value = True config.GitlabConfigParser("there") self.assertRaises(config.GitlabIDError, config.GitlabConfigParser) - fd = six.StringIO(valid_config) + fd = io.StringIO(valid_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd self.assertRaises( @@ -97,9 +97,9 @@ class TestConfigParser(unittest.TestCase): ) @mock.patch("os.path.exists") - @mock.patch("six.moves.builtins.open") + @mock.patch("builtins.open") def test_invalid_data(self, m_open, path_exists): - fd = six.StringIO(missing_attr_config) + fd = io.StringIO(missing_attr_config) fd.close = mock.Mock(return_value=None, side_effect=lambda: fd.seek(0)) m_open.return_value = fd path_exists.return_value = True @@ -117,9 +117,9 @@ class TestConfigParser(unittest.TestCase): self.assertEqual("Unsupported per_page number: 200", emgr.exception.args[0]) @mock.patch("os.path.exists") - @mock.patch("six.moves.builtins.open") + @mock.patch("builtins.open") def test_valid_data(self, m_open, path_exists): - fd = six.StringIO(valid_config) + fd = io.StringIO(valid_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd path_exists.return_value = True @@ -133,7 +133,7 @@ class TestConfigParser(unittest.TestCase): self.assertEqual(True, cp.ssl_verify) self.assertIsNone(cp.per_page) - fd = six.StringIO(valid_config) + fd = io.StringIO(valid_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd cp = config.GitlabConfigParser(gitlab_id="two") @@ -144,7 +144,7 @@ class TestConfigParser(unittest.TestCase): self.assertEqual(10, cp.timeout) self.assertEqual(False, cp.ssl_verify) - fd = six.StringIO(valid_config) + fd = io.StringIO(valid_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd cp = config.GitlabConfigParser(gitlab_id="three") @@ -156,7 +156,7 @@ class TestConfigParser(unittest.TestCase): self.assertEqual("/path/to/CA/bundle.crt", cp.ssl_verify) self.assertEqual(50, cp.per_page) - fd = six.StringIO(valid_config) + fd = io.StringIO(valid_config) fd.close = mock.Mock(return_value=None) m_open.return_value = fd cp = config.GitlabConfigParser(gitlab_id="four") |