python-twitter-tools / twitter

Python Twitter API
http://mike.verdone.ca/twitter/
MIT License
3.17k stars 710 forks source link

Mock could be just optional dependency #441

Closed mcepl closed 2 years ago

mcepl commented 2 years ago

While packaging this package for openSUSE I have discovered that mock is really unnecessary dependency as it is part of the standard library since 3.3. This patch takes care of it:

---
 tests/test_cmdline.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -3,7 +3,10 @@
 import json
 import re
 import unittest
-from mock import patch
+try:
+    from mock import patch
+except ImportError:
+    from unittest.mock import patch

 try:
     import HTMLParser