From 7385ede666616aaaa1dc33f6e4cdad21cb8d6a0d Mon Sep 17 00:00:00 2001 From: Daniel Alley Date: Tue, 30 Nov 2021 23:04:18 -0500 Subject: [PATCH] Drop Python 2 support closes #158 --- .travis.yml | 2 -- README.md | 7 ------ productmd/__init__.py | 2 -- productmd/common.py | 28 +++++++++++----------- productmd/compose.py | 3 --- productmd/composeinfo.py | 49 ++++++++++++++++++--------------------- productmd/discinfo.py | 2 +- productmd/extra_files.py | 4 +--- productmd/images.py | 31 +++++++++++-------------- productmd/modules.py | 9 +++---- productmd/rpms.py | 5 +--- productmd/treeinfo.py | 25 ++++++++------------ python-productmd.spec | 42 --------------------------------- setup.py | 5 +--- tests/test_common.py | 4 +--- tests/test_compose.py | 19 +++++++-------- tests/test_composeinfo.py | 6 ++--- tests/test_discinfo.py | 6 ++--- tests/test_extra_files.py | 4 ++-- tests/test_header.py | 4 +--- tests/test_images.py | 4 +--- tests/test_modules.py | 4 +--- tests/test_rpms.py | 4 +--- tests/test_treeinfo.py | 6 ++--- tox.ini | 3 +-- 25 files changed, 88 insertions(+), 190 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd1dea2..9111458 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: python matrix: include: - - python: "2.7" - env: TOXENV=py27 - python: "3.6" env: TOXENV=py36 - python: "3.7" diff --git a/README.md b/README.md index 27d5304..3248cbf 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,6 @@ http://productmd.readthedocs.io/en/latest/ Building -------- -### Build requires - -* Six: Python 2 and 3 Compatibility Library - * `pip install six` - * Fedora: `dnf install python-six python3-six` - - ### Build To see all options run: diff --git a/productmd/__init__.py b/productmd/__init__.py index 6d3b108..85a4535 100644 --- a/productmd/__init__.py +++ b/productmd/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or diff --git a/productmd/common.py b/productmd/common.py index cf25939..e5bf13f 100644 --- a/productmd/common.py +++ b/productmd/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # pylint: disable=super-on-old-class @@ -29,14 +28,15 @@ import sys import re import json +import http import codecs import contextlib import ssl import warnings +import urllib -import six -from six.moves.configparser import ConfigParser - +from configparser import ConfigParser +from io import StringIO VERSION = (1, 2) @@ -165,7 +165,7 @@ def _urlopen(path): # Older Python versions (<2.7.9) do not support it. In those cases the # ssl module will not have the method to create the context. kwargs['context'] = ssl._create_unverified_context() - return six.moves.urllib.request.urlopen(path, **kwargs) + return urllib.request.urlopen(path, **kwargs) @contextlib.contextmanager @@ -178,7 +178,7 @@ def open_file_obj(f, mode="r"): :param mode: how to open the file :type mode: string """ - if isinstance(f, six.string_types): + if isinstance(f, str): if f.startswith(("http://", "https://", "ftp://")): file_obj = _urlopen(f) yield file_obj @@ -195,7 +195,7 @@ def _file_exists(path): try: file_obj = _urlopen(path) file_obj.close() - except six.moves.urllib.error.HTTPError: + except urllib.error.HTTPError: return False return True return os.path.exists(path) @@ -269,7 +269,7 @@ def loads(self, s): :param s: input data :type s: str """ - io = six.StringIO() + io = StringIO() io.write(s) io.seek(0) self.load(io) @@ -294,7 +294,7 @@ def dumps(self): :rtype: str """ - io = six.StringIO() + io = StringIO() self.dump(io) io.seek(0) return io.read() @@ -306,12 +306,10 @@ def parse_file(self, f): f.seek(0) elif hasattr(f, "seek"): f.seek(0) - if six.PY3 and isinstance(f, six.moves.http_client.HTTPResponse): + if isinstance(f, http.client.HTTPResponse): # HTTPResponse needs special handling in py3 reader = codecs.getreader("utf-8") parser = json.load(reader(f)) - else: - parser = json.load(f) return parser def build_file(self, parser, f): @@ -343,7 +341,7 @@ def __init__(self, parent, metadata_type): self.metadata_type = metadata_type def _validate_version(self): - self._assert_type("version", six.string_types) + self._assert_type("version", [str]) self._assert_matches_re("version", [r"^\d+\.\d+$"]) @property @@ -550,7 +548,7 @@ def __init__(self, *args, **kwargs): ConfigParser.__init__(self, *args, **kwargs) else: kwargs["dict_type"] = SortedDict - super(SortedConfigParser, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.seen = set() def optionxform(self, optionstr): @@ -566,4 +564,4 @@ def option_lookup(self, section_option_list, default=None): def read_file(self, *args, **kwargs): if sys.version_info[0] == 2: return self.readfp(*args, **kwargs) - return super(SortedConfigParser, self).read_file(*args, **kwargs) + return super().read_file(*args, **kwargs) diff --git a/productmd/compose.py b/productmd/compose.py index 91c89f4..466a8bf 100644 --- a/productmd/compose.py +++ b/productmd/compose.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or diff --git a/productmd/composeinfo.py b/productmd/composeinfo.py index 57f2fdd..2e2cfe9 100644 --- a/productmd/composeinfo.py +++ b/productmd/composeinfo.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -36,8 +33,6 @@ import productmd.common from productmd.common import Header, RELEASE_VERSION_RE -import six - __all__ = ( "ComposeInfo", @@ -47,9 +42,8 @@ ) -if six.PY3: - def cmp(a, b): - return (a > b) - (a < b) +def cmp(a, b): + return (a > b) - (a < b) # order matters - used in __cmp__ @@ -121,7 +115,7 @@ class ComposeInfo(productmd.common.MetadataBase): """ def __init__(self): - super(ComposeInfo, self).__init__() + super().__init__() self.header = Header(self, "productmd.composeinfo") #: (:class:`.Header`) -- Metadata header self.compose = Compose(self) #: (:class:`.Compose`) -- Compose details @@ -265,7 +259,7 @@ class Compose(productmd.common.MetadataBase): """ def __init__(self, metadata): - super(Compose, self).__init__() + super().__init__() self._section = "compose" self._metadata = metadata self.id = None @@ -293,22 +287,22 @@ def __cmp__(self, other): return 0 def _validate_id(self): - self._assert_type("id", list(six.string_types)) + self._assert_type("id", [str]) self._assert_not_blank("id") self._assert_matches_re("id", [r".*\d{8}(\.nightly|\.n|\.ci|\.test|\.t)?(\.\d+)?"]) def _validate_date(self): - self._assert_type("date", list(six.string_types)) + self._assert_type("date", [str]) self._assert_matches_re("date", [r"^\d{8}$"]) def _validate_type(self): self._assert_value("type", COMPOSE_TYPES) def _validate_respin(self): - self._assert_type("respin", list(six.integer_types)) + self._assert_type("respin", [int]) def _validate_label(self): - self._assert_type("label", [type(None)] + list(six.string_types)) + self._assert_type("label", [type(None), str]) verify_label(self.label) def _validate_final(self): @@ -397,7 +391,7 @@ class BaseProduct(productmd.common.MetadataBase): """ def __init__(self, metadata): - super(BaseProduct, self).__init__() + super().__init__() self._section = "base_product" self._metadata = metadata self.name = None #: (*str*) -- Product name, for example: "Fedora", "Red Hat Enterprise Linux" @@ -421,20 +415,20 @@ def __str__(self): return "%s-%s" % (self.short, self.version) def _validate_name(self): - self._assert_type("name", list(six.string_types)) + self._assert_type("name", [str]) def _validate_version(self): """If the version starts with a digit, it must be a sematic-versioning style string. """ - self._assert_type("version", list(six.string_types)) + self._assert_type("version", [str]) self._assert_matches_re("version", [RELEASE_VERSION_RE]) def _validate_short(self): - self._assert_type("short", list(six.string_types)) + self._assert_type("short", [str]) def _validate_type(self): - self._assert_type("type", list(six.string_types)) + self._assert_type("type", [str]) self._assert_value("type", productmd.common.RELEASE_TYPES) @property @@ -478,7 +472,7 @@ class Release(BaseProduct): """ def __init__(self, metadata): - super(Release, self).__init__(metadata) + super().__init__(metadata) self._section = "release" self.name = None #: (*str*) -- Release name, for example: "Fedora", "Red Hat Enterprise Linux" @@ -494,7 +488,7 @@ def __cmp__(self, other): return BaseProduct.__cmp__(self, other) def _validate_type(self): - self._assert_type("type", list(six.string_types)) + self._assert_type("type", [str]) self._assert_value("type", productmd.common.RELEASE_TYPES) def _validate_is_layered(self): @@ -539,7 +533,7 @@ def deserialize_1_0(self, data): class VariantBase(productmd.common.MetadataBase): def __init__(self, metadata): - super(VariantBase, self).__init__() + super().__init__() self._metadata = metadata self.parent = None self.variants = {} @@ -548,7 +542,7 @@ def __repr__(self): if hasattr(self, "compose"): return u'<%s:%s>' % (self.__class__.__name__, self._metadata.compose.id) else: - return super(VariantBase, self).__repr__() + return super().__repr__() def __getitem__(self, name): # There can be exceptions, like $variant-optional on top-level, @@ -625,7 +619,7 @@ def get_variants(self, arch=None, types=None, recursive=False): if "self" in types: result.append(self) - for variant in six.itervalues(self.variants): + for variant in self.variants.values(): if types and variant.type not in types: continue if arch and arch not in variant.arches.union(["src"]): @@ -642,8 +636,9 @@ class Variants(VariantBase): """ This class is a container for compose variants. """ + def __init__(self, metadata): - super(Variants, self).__init__(metadata) + super().__init__(metadata) self._section = "variants" def serialize(self, data): @@ -813,7 +808,7 @@ def __repr__(self): return u'<%s:%s>' % (self.__class__.__name__, self.uid) def _validate_id(self): - self._assert_type("id", list(six.string_types)) + self._assert_type("id", [str]) self._assert_matches_re("id", [r"^[a-zA-Z0-9]+$"]) def _validate_uid(self): @@ -828,7 +823,7 @@ def _validate_uid(self): raise ValueError("UID '%s' doesn't align with parent UID '%s'" % (self.uid, uid)) def _validate_name(self): - self._assert_type("name", list(six.string_types)) + self._assert_type("name", [str]) self._assert_not_blank("name") def _validate_type(self): diff --git a/productmd/discinfo.py b/productmd/discinfo.py index 4918481..3e27b06 100644 --- a/productmd/discinfo.py +++ b/productmd/discinfo.py @@ -41,7 +41,7 @@ class DiscInfo(productmd.common.MetadataBase): """ def __init__(self): - super(DiscInfo, self).__init__() + super().__init__() self.timestamp = None #: Timestamp in float format self.description = None #: Release description, for example: Fedora 20 self.arch = None #: Media architecture, for example: x86_64 diff --git a/productmd/extra_files.py b/productmd/extra_files.py index aa4f344..89f31aa 100644 --- a/productmd/extra_files.py +++ b/productmd/extra_files.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright (C) 2019 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -28,7 +26,7 @@ class ExtraFiles(productmd.common.MetadataBase): def __init__(self): - super(ExtraFiles, self).__init__() + super().__init__() self.header = Header(self, "productmd.extra_files") self.compose = Compose(self) self.extra_files = {} diff --git a/productmd/images.py b/productmd/images.py index 8ac0f7b..d2978c8 100644 --- a/productmd/images.py +++ b/productmd/images.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -55,8 +52,6 @@ from collections import namedtuple from itertools import chain -import six - __all__ = ( "Image", @@ -126,7 +121,7 @@ class Images(productmd.common.MetadataBase): def __init__(self): - super(Images, self).__init__() + super().__init__() self.header = Header(self, "productmd.images") self.compose = Compose(self) self.images = {} @@ -227,7 +222,7 @@ def identify_image(image): class Image(productmd.common.MetadataBase): def __init__(self, parent): - super(Image, self).__init__() + super().__init__() self.parent = parent self.path = None #: (*str*) -- relative path to an image, for example: "Server/x86_64/iso/boot.iso" self.mtime = None #: (*int*) -- image mtime @@ -249,45 +244,45 @@ def __repr__(self): return "".format(self) def _validate_path(self): - self._assert_type("path", list(six.string_types)) + self._assert_type("path", [str]) self._assert_not_blank("path") def _validate_mtime(self): - self._assert_type("mtime", list(six.integer_types)) + self._assert_type("mtime", [int]) def _validate_size(self): - self._assert_type("size", list(six.integer_types)) + self._assert_type("size", [int]) self._assert_not_blank("size") def _validate_volume_id(self): - self._assert_type("volume_id", [type(None)] + list(six.string_types)) + self._assert_type("volume_id", [type(None), str]) if self.volume_id is not None: self._assert_not_blank("volume_id") def _validate_type(self): - self._assert_type("type", list(six.string_types)) + self._assert_type("type", [str]) self._assert_value("type", SUPPORTED_IMAGE_TYPES) def _validate_format(self): - self._assert_type("format", list(six.string_types)) + self._assert_type("format", [str]) self._assert_value("format", SUPPORTED_IMAGE_FORMATS) def _validate_arch(self): - self._assert_type("arch", list(six.string_types)) + self._assert_type("arch", [str]) self._assert_not_blank("arch") def _validate_disc_number(self): - self._assert_type("disc_number", list(six.integer_types)) + self._assert_type("disc_number", [int]) def _validate_disc_count(self): - self._assert_type("disc_count", list(six.integer_types)) + self._assert_type("disc_count", [int]) def _validate_checksums(self): self._assert_type("checksums", [dict]) self._assert_not_blank("checksums") def _validate_implant_md5(self): - self._assert_type("implant_md5", [type(None)] + list(six.string_types)) + self._assert_type("implant_md5", [type(None), str]) if self.implant_md5 is not None: self._assert_matches_re("implant_md5", [r"^[a-z0-9]{32}$"]) @@ -295,7 +290,7 @@ def _validate_bootable(self): self._assert_type("bootable", [bool]) def _validate_subvariant(self): - self._assert_type("subvariant", list(six.string_types)) + self._assert_type("subvariant", [str]) def _validate_unified(self): self._assert_type("unified", [bool]) diff --git a/productmd/modules.py b/productmd/modules.py index cf53425..f41ce85 100644 --- a/productmd/modules.py +++ b/productmd/modules.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - # Copyright (C) 2017 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -17,7 +15,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import re -import six import productmd.common from productmd.common import Header, RPM_ARCHES @@ -31,7 +28,7 @@ class Modules(productmd.common.MetadataBase): def __init__(self): - super(Modules, self).__init__() + super().__init__() self.header = Header(self, "productmd.modules") self.compose = Compose(self) self.modules = {} @@ -44,7 +41,7 @@ def __delitem__(self, variant): @staticmethod def parse_uid(uid): - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise ValueError("Uid has to be string: %s" % uid) # pattern to parse uid MODULE_NAME:STREAM[:VERSION[:CONTEXT]] @@ -63,7 +60,7 @@ def parse_uid(uid): return uid_dict def _check_uid(self, uid): - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise ValueError("Uid has to be string: %s" % uid) if ":" not in uid: raise ValueError("Missing stream in uid: %s" % uid) diff --git a/productmd/rpms.py b/productmd/rpms.py index dbff96d..18cc3b1 100644 --- a/productmd/rpms.py +++ b/productmd/rpms.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -65,7 +62,7 @@ class Rpms(productmd.common.MetadataBase): def __init__(self): - super(Rpms, self).__init__() + super().__init__() self.header = Header(self, "productmd.rpms") self.compose = Compose(self) self.rpms = {} diff --git a/productmd/treeinfo.py b/productmd/treeinfo.py index 5ebb114..b698f8c 100644 --- a/productmd/treeinfo.py +++ b/productmd/treeinfo.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- - - # Copyright (C) 2015 Red Hat, Inc. # # This library is free software; you can redistribute it and/or @@ -28,8 +25,6 @@ import hashlib import re -import six - import productmd.common import productmd.composeinfo @@ -181,15 +176,15 @@ def __init__(self, metadata): self.version = None #: (*str*) -- base product *major* version, for example: "21", "7" def _validate_name(self): - self._assert_type("name", list(six.string_types)) + self._assert_type("name", [str]) def _validate_version(self): - self._assert_type("version", list(six.string_types)) + self._assert_type("version", [str]) if re.match(r'^\d', self.version): self._assert_matches_re("version", [r"^\d+(\.\d+)*$"]) def _validate_short(self): - self._assert_type("short", list(six.string_types)) + self._assert_type("short", [str]) def serialize(self, parser): self.validate() @@ -313,11 +308,11 @@ def __init__(self, _metadata): self.platforms = set() #: (*set(str)*), supported platforms; for example x86_64,xen def _validate_arch(self): - self._assert_type("arch", list(six.string_types)) + self._assert_type("arch", [str]) self._assert_not_blank("arch") def _validate_build_timestamp(self): - self._assert_type("build_timestamp", list(six.integer_types) + [float]) + self._assert_type("build_timestamp", [int, float]) self._assert_not_blank("build_timestamp") def serialize(self, parser): @@ -799,7 +794,7 @@ def serialize(self, parser): class Images(productmd.common.MetadataBase): def __init__(self, metadata): - super(Images, self).__init__() + super().__init__() self._metadata = metadata self.images = {} @@ -858,7 +853,7 @@ def _validate_platforms(self): class Stage2(productmd.common.MetadataBase): def __init__(self, metadata): - super(Stage2, self).__init__() + super().__init__() self._section = "stage2" self._metadata = metadata self.mainimage = None #: (*str*) -- relative path to Anaconda stage2 image @@ -895,7 +890,7 @@ def deserialize(self, parser): def _validate_mainimage(self): if self.mainimage: - self._assert_type("mainimage", list(six.string_types)) + self._assert_type("mainimage", [str]) if self.mainimage.startswith("/"): raise ValueError("Only relative paths are allowed for images: %s" % self.mainimage) @@ -972,10 +967,10 @@ def __init__(self, metadata): self.totaldiscs = None #: number of discs in media set def _validate_discnum(self): - self._assert_type("discnum", list(six.integer_types) + [type(None)]) + self._assert_type("discnum", [str, type(None)]) def _validate_totaldiscs(self): - self._assert_type("totaldiscs", list(six.integer_types) + [type(None)]) + self._assert_type("totaldiscs", [str, type(None)]) def serialize(self, parser): if not self.discnum and not self.totaldiscs: diff --git a/python-productmd.spec b/python-productmd.spec index 219164e..c9dda86 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -22,72 +22,30 @@ and installation media. %description %_description -%package -n python2-productmd -Summary: %summary -Obsoletes: productmd <= %{version}-%{release} -Provides: productmd = %{version}-%{release} -BuildRequires: python2-devel -%if 0%{?rhel} && 0%{?rhel} <= 7 -BuildRequires: python-setuptools -BuildRequires: python-six -Requires: python-six -%else -BuildRequires: python2-setuptools -BuildRequires: python2-six -Requires: python2-six -%endif -%{?python_provide:%python_provide python2-productmd} - -%description -n python2-productmd %_description - -%if 0%{?with_python3} %package -n python%{python3_pkgversion}-productmd Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools -BuildRequires: python%{python3_pkgversion}-six -Requires: python%{python3_pkgversion}-six %description -n python%{python3_pkgversion}-productmd %_description -%endif %prep %setup -q %build -%py2_build - -%if 0%{?with_python3} %py3_build -%endif %install -%py2_install - -%if 0%{?with_python3} %py3_install -%endif %check -%{__python2} ./setup.py test - -%if 0%{?with_python3} %{__python3} ./setup.py test -%endif - -%files -n python2-productmd -%license LICENSE -%doc AUTHORS -%{python2_sitelib}/productmd/ -%{python2_sitelib}/productmd-%{version}-py?.?.egg-info -%if 0%{?with_python3} %files -n python%{python3_pkgversion}-productmd %license LICENSE %doc AUTHORS %{python3_sitelib}/productmd/ %{python3_sitelib}/productmd-%{version}-py?.?.egg-info -%endif %changelog * Mon May 24 2021 Lubomír Sedlář 1.33-1 diff --git a/setup.py b/setup.py index 6000aaa..147336c 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- @@ -29,7 +29,4 @@ packages = packages, scripts = [], test_suite = "tests", - install_requires=[ - 'six', - ], ) diff --git a/tests/test_common.py b/tests/test_common.py index 080d0d3..0bd3df5 100755 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # diff --git a/tests/test_compose.py b/tests/test_compose.py index 5335574..36cb850 100755 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # @@ -30,14 +28,14 @@ from productmd.compose import Compose # noqa import productmd.common -from six import StringIO -from six.moves.urllib.error import HTTPError +from io import StringIO +from urllib.error import HTTPError class TestCompose(unittest.TestCase): def __init__(self, *args, **kwargs): - super(TestCompose, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.compose_path = os.path.join(DIR, "compose") def test_read_composeinfo(self): @@ -71,19 +69,20 @@ def mock_urlopen(url, context=None): raise HTTPError(404, e) return f - orig_urlopen = productmd.common.six.moves.urllib.request.urlopen + import urllib + orig_urlopen = urllib.request.urlopen try: - productmd.common.six.moves.urllib.request.urlopen = mock_urlopen + urllib.request.urlopen = mock_urlopen compose = Compose('http://example.noexist/path/to/mycompose') self.assertEqual('MYPRODUCT', compose.info.release.short) finally: - productmd.common.six.moves.urllib.request.urlopen = orig_urlopen + urllib.request.urlopen = orig_urlopen class TestLegacyCompose(unittest.TestCase): def __init__(self, *args, **kwargs): - super(TestLegacyCompose, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.compose_path = os.path.join(DIR, "compose-legacy") def test_read_composeinfo(self): diff --git a/tests/test_composeinfo.py b/tests/test_composeinfo.py index 3d24157..cfabf88 100755 --- a/tests/test_composeinfo.py +++ b/tests/test_composeinfo.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # @@ -34,7 +32,7 @@ class TestComposeInfo(unittest.TestCase): def __init__(self, *args, **kwargs): - super(TestComposeInfo, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.treeinfo_path = os.path.join(DIR, "treeinfo") def setUp(self): diff --git a/tests/test_discinfo.py b/tests/test_discinfo.py index 1609709..0b3dae4 100755 --- a/tests/test_discinfo.py +++ b/tests/test_discinfo.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/python3 # Copyright (C) 2015 Red Hat, Inc. # @@ -34,7 +32,7 @@ class TestDiscInfo(unittest.TestCase): def __init__(self, *args, **kwargs): - super(TestDiscInfo, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.discinfo_path = os.path.join(DIR, "discinfo") def setUp(self): diff --git a/tests/test_extra_files.py b/tests/test_extra_files.py index 8f12944..ddf93e7 100755 --- a/tests/test_extra_files.py +++ b/tests/test_extra_files.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 # Copyright (C) 2019 Red Hat, Inc. # @@ -24,7 +24,7 @@ import tempfile import shutil -from six import StringIO +from io import StringIO DIR = os.path.dirname(__file__) sys.path.insert(0, os.path.join(DIR, "..")) diff --git a/tests/test_header.py b/tests/test_header.py index e888793..31712ca 100755 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # diff --git a/tests/test_images.py b/tests/test_images.py index c4037d3..0ce34d3 100755 --- a/tests/test_images.py +++ b/tests/test_images.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # diff --git a/tests/test_modules.py b/tests/test_modules.py index 9d50021..6f3fa8d 100755 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2018 Red Hat, Inc. # diff --git a/tests/test_rpms.py b/tests/test_rpms.py index ba44b60..c81361c 100755 --- a/tests/test_rpms.py +++ b/tests/test_rpms.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # diff --git a/tests/test_treeinfo.py b/tests/test_treeinfo.py index 3daa6ee..dd274fc 100755 --- a/tests/test_treeinfo.py +++ b/tests/test_treeinfo.py @@ -1,6 +1,4 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - +#!/usr/bin/env python3 # Copyright (C) 2015 Red Hat, Inc. # @@ -34,7 +32,7 @@ class TestTreeInfo(unittest.TestCase): def __init__(self, *args, **kwargs): - super(TestTreeInfo, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.treeinfo_path = os.path.join(DIR, "treeinfo") def setUp(self): diff --git a/tox.ini b/tox.ini index 0712f0b..310eac4 100644 --- a/tox.ini +++ b/tox.ini @@ -5,11 +5,10 @@ max-line-length = 140 [tox] skipsdist = True -envlist = py27,py36,py37,py38,py39 +envlist = py36,py37,py38,py39 skip_missing_interpreters = True [testenv] deps = pytest - six commands = pytest {posargs}