refactor: use try ImportError instead of py-version check (#1034)

main
Chyroc 6 years ago committed by Selwin Ong
parent 4b8e615644
commit 7eb95bf405

@ -13,10 +13,9 @@ def is_python_version(*versions):
return False
# functools.total_ordering is only available from Python 2.7 and 3.2
if is_python_version((2, 7), (3, 2)):
try:
from functools import total_ordering
else:
except ImportError:
def total_ordering(cls): # noqa
"""Class decorator that fills in missing ordering methods"""
convert = {

@ -6,11 +6,10 @@ import logging
from redis import Redis
from rq import pop_connection, push_connection
from rq.compat import is_python_version
if is_python_version((2, 7), (3, 2)):
try:
import unittest
else:
except ImportError:
import unittest2 as unittest # noqa

@ -4,7 +4,6 @@ from __future__ import (absolute_import, division, print_function,
from click.testing import CliRunner
from rq import get_failed_queue, Queue
from rq.compat import is_python_version
from rq.job import Job
from rq.cli import main
from rq.cli.helpers import read_config_file, CliConfig
@ -13,9 +12,9 @@ import pytest
from tests import RQTestCase
from tests.fixtures import div_by_zero
if is_python_version((2, 7), (3, 2)):
try:
from unittest import TestCase
else:
except ImportError:
from unittest2 import TestCase # noqa

Loading…
Cancel
Save