From c60dd14b05f09c482d499d10b706a7dd77f0aea2 Mon Sep 17 00:00:00 2001 From: Bastien Vallet Date: Fri, 17 Jul 2020 11:44:47 +0200 Subject: [PATCH] [cleanup] Fix CI tests and some various cleanup --- .travis.yml | 8 +++----- freezegun/_async.py | 2 -- requirements.txt | 6 ++---- setup.py | 6 +----- tests/fake_module.py | 3 +-- tests/test_asyncio.py | 11 +++-------- tests/test_datetimes.py | 1 - tests/test_ticking.py | 6 ++---- tests/test_utils.py | 7 +------ tests/test_uuid.py | 1 - tox.ini | 3 +-- 11 files changed, 14 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e388739..06cfd734 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: python -cache: pip python: - 3.5 - 3.6 @@ -7,9 +6,8 @@ python: - 3.8 - pypy3 -script: make travis -install: - - pip install . - - pip install -r requirements.txt +install: pip install tox-travis +script: + tox after_success: - coveralls diff --git a/freezegun/_async.py b/freezegun/_async.py index 3974e29f..d26b7a21 100644 --- a/freezegun/_async.py +++ b/freezegun/_async.py @@ -1,7 +1,5 @@ import functools -import asyncio - def wrap_coroutine(api, coroutine): @functools.wraps(coroutine) diff --git a/requirements.txt b/requirements.txt index 3f3e5cbe..08059924 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ -coverage +pytest pytest-coverage coveralls -mock -pytest>=4.6 -maya; python_version >= '3.6' +maya; python_version >= '3.7' diff --git a/setup.py b/setup.py index 4123796e..5c8e3191 100644 --- a/setup.py +++ b/setup.py @@ -2,9 +2,6 @@ from setuptools import setup -requires = ['python-dateutil>=2.7'] -tests_require = ['nose'] - with open('README.rst') as f: readme = f.read() @@ -17,8 +14,7 @@ author_email='spulec@gmail.com', url='https://github.com/spulec/freezegun', packages=['freezegun'], - install_requires=requires, - tests_require=tests_require, + install_requires=['python-dateutil>=2.7'], include_package_data=True, license='Apache 2.0', python_requires='>=3.5', diff --git a/tests/fake_module.py b/tests/fake_module.py index 1adfe8f5..323cab21 100644 --- a/tests/fake_module.py +++ b/tests/fake_module.py @@ -1,5 +1,4 @@ -from datetime import datetime -from datetime import date +from datetime import date, datetime from time import time, localtime, gmtime, strftime diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py index b561a3dc..db2cdbe8 100644 --- a/tests/test_asyncio.py +++ b/tests/test_asyncio.py @@ -1,22 +1,17 @@ +import asyncio import datetime from textwrap import dedent from unittest import SkipTest - from freezegun import freeze_time -try: - import asyncio -except ImportError: - asyncio = False - def test_time_freeze_coroutine(): if not asyncio: raise SkipTest('asyncio required') - @asyncio.coroutine + @freeze_time('1970-01-01') - def frozen_coroutine(): + async def frozen_coroutine(): assert datetime.date.today() == datetime.date(1970, 1, 1) asyncio.get_event_loop().run_until_complete(frozen_coroutine()) diff --git a/tests/test_datetimes.py b/tests/test_datetimes.py index 1e81e494..d1d76762 100644 --- a/tests/test_datetimes.py +++ b/tests/test_datetimes.py @@ -15,7 +15,6 @@ try: import maya - except ImportError: maya = None diff --git a/tests/test_ticking.py b/tests/test_ticking.py index 9a22f8e4..d7e2e749 100644 --- a/tests/test_ticking.py +++ b/tests/test_ticking.py @@ -1,9 +1,7 @@ import datetime import time -try: - from unittest import mock -except (ImportError, AttributeError): - import mock + +from unittest import mock import pytest from freezegun import freeze_time diff --git a/tests/test_utils.py b/tests/test_utils.py index 3f845dd8..6973bda1 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,9 +1,4 @@ -from unittest import SkipTest - -try: - from unittest import mock -except (ImportError, AttributeError): - import mock +from unittest import SkipTest, mock from freezegun import api from tests import utils diff --git a/tests/test_uuid.py b/tests/test_uuid.py index 6244736a..08ae8a14 100644 --- a/tests/test_uuid.py +++ b/tests/test_uuid.py @@ -1,4 +1,3 @@ -from __future__ import print_function, absolute_import, unicode_literals import datetime import uuid diff --git a/tox.ini b/tox.ini index e5d0bbd6..dc083486 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,5 @@ envlist = py35, py36, py37, py38, pypy3 [testenv] -commands = make test NOSE_ARGS="{posargs}" -whitelist_externals = make +commands = pytest --cov deps = -rrequirements.txt