From b4c06a4bb7800026809cfabf69565845dbc00923 Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 28 Sep 2021 00:14:18 -0500 Subject: [PATCH] Remove nose usage --- .github/workflows/test.yml | 2 +- docs/running_tests.rst | 7 ++++--- setup.cfg | 5 ----- setup.py | 3 +-- tests/test_api.py | 2 +- tests/test_auth.py | 2 +- tests/test_client.py | 2 +- tests/test_cursors.py | 2 +- tests/test_rate_limit.py | 2 +- tests/test_resultset.py | 2 +- tox.ini | 2 +- 11 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48ff401..789a4ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: pip install .[dev,test] - name: Run tests run: | - python setup.py nosetests + coverage run -m unittest discover tests - name: Send coverage to Coveralls continue-on-error: true env: diff --git a/docs/running_tests.rst b/docs/running_tests.rst index 4dd397f..6ba079a 100644 --- a/docs/running_tests.rst +++ b/docs/running_tests.rst @@ -12,9 +12,10 @@ These steps outline how to run tests for Tweepy: ``pip install .[test]``. Optionally install the ``dev`` extra as well, for ``tox`` and ``coverage``, e.g. ``pip install .[dev,test]``. -3. Run ``python setup.py nosetests`` or simply ``nosetests`` in the source - directory. With the ``dev`` extra, coverage will be shown, and ``tox`` can - also be run to test different Python versions. +3. Run tests (e.g. ``python -m unittest discover tests``) in the source + directory. With the ``dev`` extra, coverage can be measured by using + ``coverage run`` (e.g. ``coverage run -m unittest discover tests``) and + ``tox`` can be run to test different Python versions. To record new cassettes, the following environment variables can be used: diff --git a/setup.cfg b/setup.cfg index 4ca9624..2a9acf1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,2 @@ [bdist_wheel] universal = 1 - -[nosetests] -tests = tests.test_api,tests.test_client,tests.test_cursors,tests.test_resultset,tests.test_utils -verbosity = 2 -with-coverage = 1 diff --git a/setup.py b/setup.py index 7f2ef1c..f0827d1 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,6 @@ with open("README.md") as readme_file: long_description = readme_file.read() tests_require = [ - "nose>=1.3.3", "vcrpy>=1.10.3", ] @@ -55,7 +54,7 @@ setup( "socks": ["requests[socks]>=2.11.1,<3"], "test": tests_require, }, - test_suite="nose.collector", + test_suite="tests", keywords="twitter library", python_requires=">=3.6", classifiers=[ diff --git a/tests/test_api.py b/tests/test_api.py index fc034fe..50e226f 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -4,7 +4,7 @@ import time import unittest from ast import literal_eval -from .config import tape, TweepyTestCase, username +from tests.config import tape, TweepyTestCase, username from tweepy import API, FileCache, MemoryCache from tweepy.models import Friendship from tweepy.parsers import Parser diff --git a/tests/test_auth.py b/tests/test_auth.py index aa7d77e..4283ccf 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -1,7 +1,7 @@ import random import unittest -from .config import * +from tests.config import * from tweepy import API, OAuthHandler diff --git a/tests/test_client.py b/tests/test_client.py index dbd3222..63168c9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,6 +1,6 @@ import unittest -from .config import ( +from tests.config import ( access_token, access_token_secret, bearer_token, consumer_key, consumer_secret, tape, user_id ) diff --git a/tests/test_cursors.py b/tests/test_cursors.py index 5e2f9ba..658f28f 100644 --- a/tests/test_cursors.py +++ b/tests/test_cursors.py @@ -1,4 +1,4 @@ -from .config import tape, TweepyTestCase, username +from tests.config import tape, TweepyTestCase, username from tweepy import Cursor diff --git a/tests/test_rate_limit.py b/tests/test_rate_limit.py index 9d386d8..6a62612 100644 --- a/tests/test_rate_limit.py +++ b/tests/test_rate_limit.py @@ -1,7 +1,7 @@ import os import unittest -from .config import create_auth +from tests.config import create_auth from tweepy import API from tweepy.errors import HTTPException diff --git a/tests/test_resultset.py b/tests/test_resultset.py index 87f4bff..66a008e 100644 --- a/tests/test_resultset.py +++ b/tests/test_resultset.py @@ -1,4 +1,4 @@ -from .config import TweepyTestCase +from tests.config import TweepyTestCase from tweepy.models import ResultSet diff --git a/tox.ini b/tox.ini index 6374a79..0999171 100644 --- a/tox.ini +++ b/tox.ini @@ -7,5 +7,5 @@ envlist = py36, py37, py38, py39 [testenv] -commands = python setup.py nosetests +commands = python -m unittest discover tests extras = test -- 2.25.1