Skip to content

Commit

Permalink
skip test for Python version below 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
yafshar committed Mar 12, 2024
1 parent b1fbf17 commit 5e29135
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/test_kim_edn/test_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

from test import support

if sys.version_info.minor >= 10:
if sys.version_info.minor >= 11:
from test.support import os_helper

if sys.version_info.minor >= 9:
from test.support.script_helper import assert_python_ok


@unittest.skipIf(sys.version_info.minor < 11, "not supported in this Python version")
@support.requires_subprocess()
class TestTool(unittest.TestCase):
data = """
Expand Down Expand Up @@ -99,23 +98,20 @@ def test_stdin_stdout(self):
self.assertEqual(process.stdout, self.expect)
self.assertEqual(process.stderr, '')

@unittest.skipIf(sys.version_info.minor < 10, "not supported in this Python version")
def _create_infile(self, data=None):
infile = os_helper.TESTFN
with open(infile, "w", encoding="utf-8") as fp:
self.addCleanup(os.remove, infile)
fp.write(data or self.data)
return infile

@unittest.skipIf(sys.version_info.minor < 9, "not supported in this Python version")
def test_infile_stdout(self):
infile = self._create_infile()
rc, out, err = assert_python_ok('-m', 'kim_edn.tool', infile)
self.assertEqual(rc, 0)
self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
self.assertEqual(err, b'')

@unittest.skipIf(sys.version_info.minor < 9, "not supported in this Python version")
def test_non_ascii_infile(self):
data = '{"msg": "\u3053\u3093\u306b\u3061\u306f"}'
expect = textwrap.dedent('''\
Expand All @@ -132,7 +128,6 @@ def test_non_ascii_infile(self):
self.assertEqual(out.splitlines(), expect.splitlines())
self.assertEqual(err, b'')

@unittest.skipIf(sys.version_info.minor < 10, "not supported in this Python version")
def test_infile_outfile(self):
infile = self._create_infile()
outfile = os_helper.TESTFN + '.out'
Expand All @@ -144,7 +139,6 @@ def test_infile_outfile(self):
self.assertEqual(out, b'')
self.assertEqual(err, b'')

@unittest.skipIf(sys.version_info.minor < 9, "not supported in this Python version")
def test_writing_in_place(self):
infile = self._create_infile()
rc, out, err = assert_python_ok('-m', 'kim_edn.tool', infile, infile)
Expand All @@ -160,14 +154,12 @@ def test_edn_lines(self):
self.assertEqual(process.stdout, self.ednlines_expect)
self.assertEqual(process.stderr, '')

@unittest.skipIf(sys.version_info.minor < 9, "not supported in this Python version")
def test_help_flag(self):
rc, out, err = assert_python_ok('-m', 'kim_edn.tool', '-h')
self.assertEqual(rc, 0)
self.assertTrue(out.startswith(b'usage: '))
self.assertEqual(err, b'')

@unittest.skipIf(sys.version_info.minor < 9, "not supported in this Python version")
def test_sort_keys_flag(self):
infile = self._create_infile()
rc, out, err = assert_python_ok('-m', 'kim_edn.tool', '--sort-keys', infile)
Expand Down

0 comments on commit 5e29135

Please sign in to comment.