ryanmcgrath / twython

Actively maintained, pure Python wrapper for the Twitter API. Supports both normal and streaming Twitter APIs.
http://stackoverflow.com/questions/tagged/twython
MIT License
1.85k stars 397 forks source link

3.9.1: pytest is failing in 5 units #551

Open kloczek opened 1 year ago

kloczek commented 1 year ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-twython-3.9.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-twython-3.9.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/twython-3.9.1 collected 132 items tests/test_auth.py sssssssss [ 6%] tests/test_core.py ....^[[AF.......FFF..F........ [ 26%] tests/test_endpoints.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 86%] tests/test_html_for_tweet.py ............. [ 96%] tests/test_streaming.py sssss [100%] ========================================================================================= FAILURES ========================================================================================== ___________________________________________________________ TwythonAPITestCase.test_get_lastfunction_header_should_return_header ____________________________________________________________ self = @responses.activate def test_get_lastfunction_header_should_return_header(self): """Test getting last specific header of the last API call works""" endpoint = 'statuses/home_timeline' url = self.get_url(endpoint) self.register_response(responses.GET, url, adding_headers={'x-rate-limit-remaining': '37'}) self.api.get(endpoint) value = self.api.get_lastfunction_header('x-rate-limit-remaining') > self.assertEqual('37', value) E AssertionError: '37' != None tests/test_core.py:269: AssertionError __________________________________________________________ TwythonAPITestCase.test_request_should_handle_400_for_missing_auth_data __________________________________________________________ self = @responses.activate def test_request_should_handle_400_for_missing_auth_data(self): """Test that Twython raises an auth error on 400 error when no oauth data sent""" endpoint = 'statuses/home_timeline' url = self.get_url(endpoint) self.register_response(responses.GET, url, body='{"errors":[{"message":"Bad Authentication data"}]}', status=400) > self.assertRaises(TwythonAuthError, self.api.request, endpoint) E AssertionError: TwythonAuthError not raised by request tests/test_core.py:237: AssertionError ________________________________________________________ TwythonAPITestCase.test_request_should_handle_400_that_is_not_auth_related _________________________________________________________ self = @responses.activate def test_request_should_handle_400_that_is_not_auth_related(self): """Test that Twython raises a normal error on 400 error when unrelated to authorization""" endpoint = 'statuses/home_timeline' url = self.get_url(endpoint) self.register_response(responses.GET, url, body='{"errors":[{"message":"Bad request"}]}', status=400) > self.assertRaises(TwythonError, self.api.request, endpoint) E AssertionError: TwythonError not raised by request tests/test_core.py:247: AssertionError _____________________________________________________________________ TwythonAPITestCase.test_request_should_handle_401 _____________________________________________________________________ self = @responses.activate def test_request_should_handle_401(self): """Test that Twython raises an auth error on 401 error""" endpoint = 'statuses/home_timeline' url = self.get_url(endpoint) self.register_response(responses.GET, url, body='{"errors":[{"message":"Error"}]}', status=401) > self.assertRaises(TwythonAuthError, self.api.request, endpoint) E AssertionError: TwythonAuthError not raised by request tests/test_core.py:227: AssertionError _________________________________________________________________ TwythonAPITestCase.test_request_should_handle_rate_limit __________________________________________________________________ self = @responses.activate def test_request_should_handle_rate_limit(self): """Test that Twython raises an rate limit error on 429""" endpoint = 'statuses/home_timeline' url = self.get_url(endpoint) self.register_response(responses.GET, url, body='{"errors":[{"message":"Rate Limit"}]}', status=429) > self.assertRaises(TwythonRateLimitError, self.api.request, endpoint) E AssertionError: TwythonRateLimitError not raised by request tests/test_core.py:257: AssertionError ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/test_auth.py:17: skipping non-updated test SKIPPED [1] tests/test_auth.py:24: skipping non-updated test SKIPPED [1] tests/test_auth.py:43: skipping non-updated test SKIPPED [1] tests/test_auth.py:49: skipping non-updated test SKIPPED [1] tests/test_auth.py:31: skipping non-updated test SKIPPED [1] tests/test_auth.py:37: skipping non-updated test SKIPPED [1] tests/test_auth.py:56: skipping non-updated test SKIPPED [1] tests/test_auth.py:61: skipping non-updated test SKIPPED [1] tests/test_auth.py:67: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:353: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:259: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:176: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:457: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:320: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:372: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:264: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:181: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:325: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:215: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:530: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:497: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:503: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:284: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:290: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:109: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:347: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:152: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:207: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:145: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:200: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:468: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:69: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:166: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:427: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:396: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:365: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:401: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:439: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:37: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:92: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:171: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:491: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:302: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:50: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:56: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:97: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:75: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:451: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:114: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:484: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:433: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:515: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:525: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:510: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:139: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:336: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:331: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:341: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:42: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:419: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:253: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:247: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:314: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:308: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:159: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:269: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:520: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:297: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:63: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:473: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:103: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:478: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:279: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:130: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:120: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:195: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:360: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:445: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:80: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:274: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:407: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:225: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:85: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:230: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:186: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:237: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:242: skipping non-updated test SKIPPED [1] tests/test_endpoints.py:220: skipping non-updated test SKIPPED [1] tests/test_streaming.py:43: skipping non-updated test SKIPPED [1] tests/test_streaming.py:30: skipping non-updated test SKIPPED [1] tests/test_streaming.py:38: skipping non-updated test SKIPPED [1] tests/test_streaming.py:34: skipping non-updated test SKIPPED [1] tests/test_streaming.py:48: skipping non-updated test FAILED tests/test_core.py::TwythonAPITestCase::test_get_lastfunction_header_should_return_header - AssertionError: '37' != None FAILED tests/test_core.py::TwythonAPITestCase::test_request_should_handle_400_for_missing_auth_data - AssertionError: TwythonAuthError not raised by request FAILED tests/test_core.py::TwythonAPITestCase::test_request_should_handle_400_that_is_not_auth_related - AssertionError: TwythonError not raised by request FAILED tests/test_core.py::TwythonAPITestCase::test_request_should_handle_401 - AssertionError: TwythonAuthError not raised by request FAILED tests/test_core.py::TwythonAPITestCase::test_request_should_handle_rate_limit - AssertionError: TwythonRateLimitError not raised by request ========================================================================= 5 failed, 34 passed, 93 skipped in 0.49s ========================================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ----------------- alabaster 0.7.13 attrs 22.2.0 Babel 2.12.1 build 0.10.0 charset-normalizer 3.1.0 distro 1.8.0 docutils 0.19 exceptiongroup 1.0.0 gpg 1.19.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.2.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 libcomps 0.1.19 MarkupSafe 2.1.2 oauthlib 3.2.2 packaging 23.0 pip 23.0.1 pluggy 1.0.0 Pygments 2.14.0 pyproject_hooks 1.0.0 pytest 7.2.2 python-dateutil 2.8.2 pytz 2023.2 PyYAML 6.0 requests 2.28.2 requests-oauthlib 1.3.1 responses 0.23.1 rpm 4.17.0 setuptools 65.6.3 six 1.16.0 snowballstemmer 2.2.0 Sphinx 6.1.3 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2.dev20230405 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1.dev20230405 sphinxcontrib-qthelp 1.0.3.dev20230405 sphinxcontrib-serializinghtml 1.1.5 tomli 2.0.1 urllib3 1.26.15 wheel 0.40.0 zipp 3.15.0 ```
ryanmcgrath commented 1 year ago

I don't really do much for this library anymore (especially given the direction Twitter has taken with their API) nor do I believe it should be packaged in any format outside of typical Python-based package environments.

The latter is a position I've come around to over the years; I can't stop people from doing it and others have done in the past, but it's not something I'm going to spend time on. That said, as I can't stop you or others I can leave this open for collaboration and/or like-minded people finding one-another.

CesarPazzi commented 1 year ago

@ryanmcgrath If you are not maintaining the repo please put it Archive mode and let anyone know in the Readme that is not maintained anymore so we can get other options.

ryanmcgrath commented 1 year ago

No. Archive mode is for projects that are explicitly discontinued. I have not discontinued Twython as it still (surprisingly) sees decent usage in certain research and university course use-cases.

I've not actively maintained Twython in quite some time now, though. I'm long past the point in my life where I do free work to provide value to an actively hostile platform. That said, for a few years another contributor did quite a bit of work and I'm certainly still open to people PRing other things. That's how open source works and I'm happy to let others take the reigns and keep it going if they want to. The README has had very explicit block about a call for maintainers for a few years now for this reason.

tl;dr: People are still free to fork, hack on, or fix things. If a PR is worth merging I will eventually take a look and do a bump release - I'm just not doing it myself. If you feel like you want a Twitter Python API wrapper that's more actively maintained, I'd suggest looking at tweepy - they're another of the old guard that's to my knowledge more actively maintained.

kloczek commented 1 year ago

No. Archive mode is for projects that are explicitly discontinued. I have not discontinued Twython as it still (surprisingly) sees decent usage in certain research and university course use-cases.

What about add note that you are looking for new maintainer? 🤔

ryanmcgrath commented 1 year ago

No. Archive mode is for projects that are explicitly discontinued. I have not discontinued Twython as it still (surprisingly) sees decent usage in certain research and university course use-cases.

What about add note that you are looking for new maintainer? 🤔

You mean like the one in the README since 2018?

Screenshot 2023-07-17 at 23 44 09 Screenshot 2023-07-17 at 23 45 04
CyberBallistix commented 2 weeks ago

Hello, did anyone found a solution since ?