Remove usage of unittest2 on Python 3
It was needed to provide assertItemsEqual method. Starting with Python 3.2, there's assertCountEqual that does the same thing. Six provides a helper that will dispatch to the existing method. With this change, unittest 2 is only needed on Python 2.6 to backport the method. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
43fb06e00f
commit
2f54745715
32 changed files with 2682 additions and 1923 deletions
|
|
@ -7,6 +7,8 @@ except ImportError:
|
|||
import tempfile
|
||||
from textwrap import dedent
|
||||
|
||||
import six
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
@ -132,29 +134,30 @@ class TestParseOutput(unittest.TestCase):
|
|||
def test_skips_debug_line(self):
|
||||
touch(self.file, "debug line\n")
|
||||
packages, modules = fus.parse_output(self.file)
|
||||
self.assertItemsEqual(packages, [])
|
||||
self.assertItemsEqual(modules, [])
|
||||
self.assertEqual(packages, set())
|
||||
self.assertEqual(modules, set())
|
||||
|
||||
def test_separates_arch(self):
|
||||
touch(self.file, "pkg-1.0-1.x86_64@repo-0\npkg-1.0-1.i686@repo-0\n")
|
||||
packages, modules = fus.parse_output(self.file)
|
||||
self.assertItemsEqual(
|
||||
six.assertCountEqual(
|
||||
self,
|
||||
packages,
|
||||
[("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())],
|
||||
)
|
||||
self.assertItemsEqual(modules, [])
|
||||
self.assertEqual(modules, set())
|
||||
|
||||
def test_marks_modular(self):
|
||||
touch(self.file, "*pkg-1.0-1.x86_64@repo-0\n")
|
||||
packages, modules = fus.parse_output(self.file)
|
||||
self.assertItemsEqual(
|
||||
self.assertEqual(
|
||||
packages,
|
||||
[("pkg-1.0-1", "x86_64", frozenset(["modular"]))],
|
||||
set([("pkg-1.0-1", "x86_64", frozenset(["modular"]))]),
|
||||
)
|
||||
self.assertItemsEqual(modules, [])
|
||||
self.assertEqual(modules, set())
|
||||
|
||||
def test_extracts_modules(self):
|
||||
touch(self.file, "module:mod:master:20181003:cafebeef.x86_64@repo-0\n")
|
||||
packages, modules = fus.parse_output(self.file)
|
||||
self.assertItemsEqual(packages, [])
|
||||
self.assertItemsEqual(modules, ["mod:master:20181003:cafebeef"])
|
||||
self.assertEqual(packages, set())
|
||||
self.assertEqual(modules, set(["mod:master:20181003:cafebeef"]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue