Closed rhyspowell closed 2 years ago
@bbelderbos Something off with the tests here and I cant quite wrap my head around it. I needed to update pretty much everything in the requirements file due to version issues with python 3.10. App itself runs, tests fail
AttributeError: 'tuple' object has no attribute 'user_timeline'
not sure if this is something to do with the the patch for the mock? It could be that I totally have it wrong as well, let me know
@bbelderbos Something off with the tests here and I cant quite wrap my head around it. I needed to update pretty much everything in the requirements file due to version issues with python 3.10. App itself runs, tests fail
AttributeError: 'tuple' object has no attribute 'user_timeline'
not sure if this is something to do with the the patch for the mock? It could be that I totally have it wrong as well, let me know
thanks, let me try it out tomorrow ...
@rhyspowell did you copy the config-template.py to config.py?
With some minor tweaks I get it working:
The tests use mock data so I did not need to set real Twitter API tokens and stuff.
yep all of that is running, the app even runs, just getting the error on the tests.
I am using python 3.10.2 if that makes any difference @bbelderbos
@rhyspowell hm I am on 3.10.0, what about Tweepy, I pip installed 4.11.0
I thought this was mocked out? Maybe you can place a breakpoint right before this line to inspect the object?
I'm on 4.10.1 of tweepy, lets see what happens if I update.
drop the break right before that line in the test. Any idea what I should be looking for?
ok, so here is the output from pytest
FAILED test_usertweets.py::TestUserTweets::test_first_tweet_returned_by_api - AttributeError: 'tuple' object has no attribute 'user_timeline'
FAILED test_usertweets.py::TestUserTweets::test_num_tweets - AttributeError: 'tuple' object has no attribute 'user_timeline'
FAILED test_usertweets.py::TestUserTweets::test_read_back_from_cached_csv - AttributeError: 'tuple' object has no attribute 'user_timeline'
We are now way outside of my comfort zone 😂
--- bbelderbos --- ['class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'getitem', 'gt', 'hash', 'init', 'init_subclass', 'le', 'len', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_get_tweets', '_save_tweets', 'api', 'auth', 'handle', 'max_id']
Nothing even like user_timeline
Haha nice :)
That version works fine for me, this is what I see in pdb on my end:
Also from my REPL:
>>> import tweepy
>>> tweepy.API
<class 'tweepy.api.API'>
>>> "user_timeline" in dir(tweepy.API)
True
>>> tweepy.__version__
'4.10.1'
ok, time i moved to pdb and not my usual print... Its going to be a learning experience
ok, so calling my file directly
running via pytest
with all the data above the error from running self.api
where have I broken it?
@rhyspowell bit odd, maybe good to debug together at some points, because we've done the obvious checks. I am merging your submission now though so you get your Hacktoberfest credit.
@bbelderbos let me know when and over what tool and we can do that.
Its already been good for me, I've learned how to map the venv in vscode and I've used PDB properly for the first time 😂
@bbelderbos let me know when and over what tool and we can do that.
Its already been good for me, I've learned how to map the venv in vscode and I've used PDB properly for the first time 😂
I will ping you on Slack ...
ATTENTION: before clicking "Create Pull Request" please submit some meta data, thanks!
Difficulty level (1-10): [5] Estimated time spent (hours): [3] Completed (yes/no): [yes(Ish)] I stretched my coding skills (if yes what did you learn?): [] Other feedback (what can we improve?): []