Skip to content

Commit

Permalink
Removed unneeded minpython/maxpython decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Aug 12, 2023
1 parent a9cd7cd commit 98212e2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
20 changes: 0 additions & 20 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,6 @@
from apscheduler.schedulers.blocking import BlockingScheduler


def minpython(*version):
version_str = '.'.join([str(num) for num in version])

def outer(func):
dec = pytest.mark.skipif(sys.version_info < version,
reason='Requires Python >= %s' % version_str)
return dec(func)
return outer


def maxpython(*version):
version_str = '.'.join([str(num) for num in version])

def outer(func):
dec = pytest.mark.skipif(sys.version_info >= version,
reason='Requires Python < %s' % version_str)
return dec(func)
return outer


@pytest.fixture
def timezone(monkeypatch):
tz = pytz.timezone('Europe/Berlin')
Expand Down
2 changes: 0 additions & 2 deletions tests/test_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from apscheduler.job import Job
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.schedulers.base import BaseScheduler
from tests.conftest import minpython

try:
from unittest.mock import Mock, MagicMock, patch
Expand Down Expand Up @@ -151,7 +150,6 @@ def func():
assert len(foos) == 0


@minpython(3, 3)
def test_broken_pool():
def listener(evt):
pid[0] = evt.retval
Expand Down
16 changes: 1 addition & 15 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding: utf-8
import platform
import sys
from datetime import date, datetime, timedelta, tzinfo
Expand All @@ -8,17 +7,15 @@

import pytest
import pytz
import six

from apscheduler.util import (
asbool, asint, astimezone, check_callable_args,
convert_to_datetime, datetime_ceil,
datetime_repr, datetime_to_utc_timestamp,
get_callable_name, iscoroutinefunction_partial, maybe_ref, obj_to_ref,
ref_to_obj, repr_escape, timedelta_seconds,
ref_to_obj, timedelta_seconds,
utc_timestamp_to_datetime,
)
from tests.conftest import maxpython, minpython


class DummyClass(object):
Expand Down Expand Up @@ -267,15 +264,6 @@ def test_maybe_ref(input, expected):
assert maybe_ref(input) == expected


@pytest.mark.parametrize('input,expected', [
(b'T\xc3\xa9st'.decode('utf-8'), 'T\\xe9st' if six.PY2 else 'Tést'),
(1, 1)
], ids=['string', 'int'])
@maxpython(3)
def test_repr_escape_py2(input, expected):
assert repr_escape(input) == expected


class TestCheckCallableArgs(object):
def test_invalid_callable_args(self):
"""
Expand Down Expand Up @@ -321,7 +309,6 @@ def test_signature_positional_only(self):
"""Tests that a function where signature() fails is accepted."""
check_callable_args(object().__setattr__, ('blah', 1), {})

@minpython(3, 4)
@pytest.mark.skipif(platform.python_implementation() == 'PyPy',
reason='PyPy does not expose signatures of builtins')
def test_positional_only_args(self):
Expand All @@ -335,7 +322,6 @@ def test_positional_only_args(self):
assert str(exc.value) == ('The following arguments cannot be given as keyword arguments: '
'value')

@minpython(3)
def test_unfulfilled_kwargs(self):
"""
Tests that attempting to schedule a job where not all keyword-only arguments are fulfilled
Expand Down

0 comments on commit 98212e2

Please sign in to comment.