Skip to content

Commit

Permalink
replace deprecated pywikibot exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiCompositeNumber committed Aug 17, 2021
1 parent d8aa33f commit 81a252d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/tests/test_nolicense.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ def test_warn_user_conflict():
)
user_talk = mock.Mock(title=mock.Mock(return_value="user_talk"), text="old_text()")
user_talk.get.side_effect = [user_talk.text, "new_old_text()"]
user_talk.save.side_effect = [pywikibot.exceptions.EditConflict(user_talk), None]
user_talk.save.side_effect = [
pywikibot.exceptions.EditConflictError(user_talk),
None,
]
with mock.patch.dict("nolicense.config", test_config):
nolicense.warn_user(
user_talk=user_talk,
Expand Down
4 changes: 2 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def save_page(
elif mode == "append":
try:
text = page.get(force=True) + text
except pywikibot.exceptions.NoPage as err:
except pywikibot.exceptions.NoPageError as err:
logger.exception(err)
if new_ok:
text = text
Expand All @@ -184,7 +184,7 @@ def save_page(
elif mode == "prepend":
try:
text = text + page.get(force=True)
except pywikibot.exceptions.NoPage as err:
except pywikibot.exceptions.NoPageError as err:
logger.exception(err)
if new_ok:
text = text
Expand Down

0 comments on commit 81a252d

Please sign in to comment.