jenkins-bot has submitted this change and it was merged.
Change subject: Revert "Make cached requests depend on logged in user" ......................................................................
Revert "Make cached requests depend on logged in user"
Travis started failing at this commit, although I have no idea how the exact error is related to this commit...
This reverts commit 9fca895a639ff6c74679da94eb3cc1c219863199.
Change-Id: I96066fd2763180e96907a2d27e45785d430f2c6f --- M pywikibot/data/api.py M tests/dry_api_tests.py 2 files changed, 1 insertion(+), 30 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index 9293def..a12764a 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -457,7 +457,7 @@ pass
def _uniquedescriptionstr(self): - return (repr(self.site) + repr(self.site.user()) + repr(sorted(self.iteritems()))) + return (repr(self.site) + repr(sorted(self.iteritems())))
def _create_file_name(self): self.http_params() # normalize self.iteritems() diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py index 99d7757..0e16a17 100644 --- a/tests/dry_api_tests.py +++ b/tests/dry_api_tests.py @@ -44,35 +44,6 @@ self.assertNotEqual(self.req._cachefile_path(), self.diffreq._cachefile_path()) self.assertNotEqual(self.req._cachefile_path(), self.diffsite._cachefile_path())
- def test_cachefile_path_different_users(self): - # Mock basesite object to test this. - class MockSite(pywikibot.site.BaseSite): - def __init__(self): - self._user = 'user' - - def user(self): - return self._user - - def encoding(self): - return 'utf-8' - - def __repr__(self): - return "MockSite()" - - def __getattr__(self, attr): - raise Exception("Attribute %r not defined" % attr) - - site = MockSite() - req = CachedRequest(expiry=1, site=site, action='query', meta='siteinfo') - userpath = req._cachefile_path() - - site._user = 'sysop' - - req = CachedRequest(expiry=1, site=site, action='query', meta='siteinfo') - sysoppath = req._cachefile_path() - - self.assertNotEqual(userpath, sysoppath) - def test_expired(self): self.assertFalse(self.req._expired(datetime.datetime.now())) self.assertTrue(self.req._expired(datetime.datetime.now() - datetime.timedelta(days=2)))
pywikibot-commits@lists.wikimedia.org