From dffa5c6244ff7db0f7be61f5e654b573c0254bb3 Mon Sep 17 00:00:00 2001 From: pinkrabbit412 Date: Wed, 30 Oct 2019 23:00:52 +0900 Subject: [PATCH] Retrieved at 2019.10.30 PM 11:00 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 원본 리포지토리 업데이트에 따른 요소 갱신. --- .travis.yml | 12 ++--- README.md | 2 +- docs/api.rst | 24 ---------- docs/index.rst | 1 + docs/running_tests.rst | 29 ++++++++++++ setup.cfg | 5 ++ setup.py | 103 ++++++++++++++++++++++++++--------------- tests/config.py | 2 +- tests/test_api.py | 5 +- tox.ini | 15 ++---- 10 files changed, 110 insertions(+), 88 deletions(-) create mode 100644 docs/running_tests.rst diff --git a/.travis.yml b/.travis.yml index c79c5b5..9095cf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,26 +5,22 @@ python: - '2.7' - '3.5' - '3.6' +- '3.7' +- '3.8' matrix: fast_finish: true - include: - - python: 3.7 - dist: xenial env: global: - - TWITTER_USERNAME="TweepyDev" - AWS_BUCKET="tweepy" - - USE_REPLAY=1 - secure: TPQSFGqdl6khXqQqTZ6euROoAmFRnONAlPXD6npvTIIN+fNfnz8lvZtOEWHo2jRPLoU3FyVUhYvTynj6B2hJinulP+RKOMbQ65HCZVHrsitwl1n1QZB5HegQDOYc5q6VTTYn/r8r5tGy35U0O80y1zycTLqSJiXlkdqsSq564pI= install: - - pip install -r test_requirements.txt -r requirements.txt - - pip install coveralls + - pip install .[dev,test] script: - - nosetests -v --with-coverage -c tests/travis-tests.cfg + - python setup.py nosetests after_success: - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then coveralls; fi diff --git a/README.md b/README.md index 47c09f6..a176697 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ GitHub and install it manually: cd tweepy python setup.py install -Python 2.7, 3.5, 3.6, & 3.7 are supported. +Python 2.7, 3.5, 3.6, 3.7, & 3.8 are supported. Community --------- diff --git a/docs/api.rst b/docs/api.rst index 244ef6c..6c9e9c0 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1126,30 +1126,6 @@ Geo Methods This is only a guideline, which may not be adhered to. -.. method:: API.reverse_geocode([lat], [long], [ip], [accuracy], \ - [granularity], [max_results]) - - Given a latitude and longitude, looks for nearby places (cities and - neighbourhoods) whose IDs can be specified in a call to - :func:`update_status` to appear as the name of the location. This call - provides a detailed response about the location in question; the - :func:`nearby_places` function should be preferred for getting a list of - places nearby without great detail. - - :param lat: The location's latitude. - :param long: The location's longitude. - :param ip: The location's IP address. Twitter will attempt to geolocate - using the IP address. - :param accuracy: Specify the "region" in which to search, such as a number - (then this is a radius in meters, but it can also take a - string that is suffixed with ft to specify feet). - If this is not passed in, then it is assumed to be 0m - :param granularity: Assumed to be `neighborhood' by default; can also be - `city'. - :param max_results: A hint as to the maximum number of results to return. - This is only a guideline, which may not be adhered to. - - .. method:: API.geo_id(id) Given *id* of a place, provide more details about that place. diff --git a/docs/index.rst b/docs/index.rst index 1c83919..1daa4f9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,6 +18,7 @@ Contents: extended_tweets.rst streaming_how_to.rst api.rst + running_tests.rst Indices and tables ================== diff --git a/docs/running_tests.rst b/docs/running_tests.rst new file mode 100644 index 0000000..3131751 --- /dev/null +++ b/docs/running_tests.rst @@ -0,0 +1,29 @@ +.. _running_tests: + +************* +Running Tests +************* + +These steps outline how to run tests for Tweepy: + +1. Download Tweepy's source code to a directory. + +2. Install from the downloaded source with the ``test`` extra, e.g. + ``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. + +To record new cassettes, the following environment variables can be used: + +``TWITTER_USERNAME`` +``CONSUMER_KEY`` +``CONSUMER_SECRET`` +``ACCESS_KEY`` +``ACCESS_SECRET`` +``USE_REPLAY`` + +Simply set ``USE_REPLAY`` to ``False`` and provide the app and account +credentials and username. diff --git a/setup.cfg b/setup.cfg index 2a9acf1..5a1e4f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,7 @@ [bdist_wheel] universal = 1 + +[nosetests] +tests = tests.test_api,tests.test_cursors,tests.test_resultset,tests.test_utils +verbosity = 2 +with-coverage = 1 diff --git a/setup.py b/setup.py index e2c3601..9491c2c 100644 --- a/setup.py +++ b/setup.py @@ -1,46 +1,73 @@ #!/usr/bin/env python -# from distutils.core import setup import re from setuptools import find_packages, setup -VERSIONFILE = "tweepy/__init__.py" -ver_file = open(VERSIONFILE, "rt").read() -VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" -mo = re.search(VSRE, ver_file, re.M) +VERSION_FILE = "tweepy/__init__.py" +with open(VERSION_FILE) as version_file: + match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + version_file.read(), re.MULTILINE) -if mo: - version = mo.group(1) +if match: + version = match.group(1) else: - raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,)) + raise RuntimeError("Unable to find version string in %s." % (VERSION_FILE,)) -setup(name="tweepy", - version=version, - description="Twitter library for python", - license="MIT", - author="Joshua Roesslein", - author_email="tweepy@googlegroups.com", - url="http://github.com/tweepy/tweepy", - packages=find_packages(exclude=['tests', 'examples']), - install_requires=[ - "PySocks>=1.5.7", - "requests>=2.11.1", - "requests_oauthlib>=0.7.0", - "six>=1.10.0", - ], - keywords="twitter library", - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Topic :: Software Development :: Libraries', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - ], - zip_safe=True) +with open("README.md") as readme_file: + long_description = readme_file.read() + +tests_require = [ + "mock>=1.0.1", + "nose>=1.3.3", + "vcrpy>=1.10.3", +] + +setup( + name="tweepy", + version=version, + description="Twitter library for Python", + long_description=long_description, + long_description_content_type="text/markdown", + license="MIT", + author="Joshua Roesslein", + author_email="tweepy@googlegroups.com", + url="https://www.tweepy.org/", + project_urls={ + "Documentation": "https://tweepy.readthedocs.io/", + "Issue Tracker": "https://github.com/tweepy/tweepy/issues", + "Source Code": "https://github.com/tweepy/tweepy", + }, + download_url="https://pypi.org/project/tweepy/", + packages=find_packages(exclude=["tests", "examples"]), + install_requires=[ + "requests[socks]>=2.11.1", + "requests_oauthlib>=0.7.0", + "six>=1.10.0", + ], + tests_require=tests_require, + extras_require={ + "dev": [ + "coveralls>=1.8.2", + "tox>=2.4.0", + ], + "test": tests_require, + }, + test_suite="nose.collector", + keywords="twitter library", + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Topic :: Software Development :: Libraries", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + ], + zip_safe=True, +) diff --git a/tests/config.py b/tests/config.py index f0e487c..0fcea92 100644 --- a/tests/config.py +++ b/tests/config.py @@ -12,7 +12,7 @@ oauth_consumer_key = os.environ.get('CONSUMER_KEY', '') oauth_consumer_secret = os.environ.get('CONSUMER_SECRET', '') oauth_token = os.environ.get('ACCESS_KEY', '') oauth_token_secret = os.environ.get('ACCESS_SECRET', '') -use_replay = os.environ.get('USE_REPLAY', False) +use_replay = os.environ.get('USE_REPLAY', True) tape = vcr.VCR( diff --git a/tests/test_api.py b/tests/test_api.py index 05d44a4..72a4c0e 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -5,8 +5,6 @@ import time import unittest from ast import literal_eval -from nose import SkipTest - from .config import tape, TweepyTestCase, use_replay, username from tweepy import API, FileCache, Friendship, MemoryCache from tweepy.parsers import Parser @@ -74,8 +72,7 @@ class TweepyAPITests(TweepyTestCase): self.api.retweets_of_me() def testretweet(self): - # TODO(josh): Need a way to get random tweets to retweet. - raise SkipTest() + self.skipTest('Missing method to retrieve random Tweet to Retweet') @tape.use_cassette('testretweets.json') def testretweets(self): diff --git a/tox.ini b/tox.ini index 26a0e8c..29e99f6 100644 --- a/tox.ini +++ b/tox.ini @@ -4,17 +4,8 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py35, py36, py37 - -[base] -deps = - mock==1.0.1 - nose==1.3.3 - vcrpy==1.10.3 +envlist = py27, py35, py36, py37, py38 [testenv] -commands = nosetests -v tests.test_api tests.test_cursors tests.test_resultset tests.test_utils -deps = - {[base]deps} -setenv = - USE_REPLAY=1 +commands = python setup.py nosetests +extras = test -- 2.25.1