mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 06:25:12 +01:00
Update tests and logging
This commit is contained in:
parent
66aaaf9ec0
commit
09ffd28df5
3 changed files with 22 additions and 8 deletions
26
README.rst
26
README.rst
|
@ -21,7 +21,7 @@ Table of contents
|
|||
- `Status`_
|
||||
|
||||
1. `Telegram API support`_
|
||||
|
||||
|
||||
2. `Python Version support`_
|
||||
|
||||
- `Installing`_
|
||||
|
@ -32,7 +32,9 @@ Table of contents
|
|||
|
||||
1. `API`_
|
||||
|
||||
2. `Examples`_
|
||||
2. `Logging`_
|
||||
|
||||
3. `Examples`_
|
||||
|
||||
- `Contact`_
|
||||
|
||||
|
@ -90,7 +92,7 @@ _`Installing`
|
|||
You can install python-telegram-bot using::
|
||||
|
||||
$ pip install python-telegram-bot
|
||||
|
||||
|
||||
Or upgrade to the latest version::
|
||||
|
||||
$ pip install python-telegram-bot --upgrade
|
||||
|
@ -191,10 +193,20 @@ There are many more API methods, to read the full API documentation::
|
|||
|
||||
$ pydoc telegram.Bot
|
||||
|
||||
To get a verbose mode to debug::
|
||||
|
||||
>>> telegram.Bot('token', debug=True)
|
||||
|
||||
-----------
|
||||
_`Logging`
|
||||
-----------
|
||||
|
||||
You can get logs in your main application by calling `logging` and setting the log level you want::
|
||||
|
||||
>>> import logging
|
||||
>>> logger = logging.getLogger()
|
||||
>>> logger.setLevel(logging.INFO)
|
||||
|
||||
If you want DEBUG logs instead::
|
||||
|
||||
>>> logger.setLevel(logging.DEBUG)
|
||||
|
||||
-----------
|
||||
_`Examples`
|
||||
-----------
|
||||
|
|
|
@ -5,5 +5,7 @@ from tests.test_bot import BotTest
|
|||
if __name__ == '__main__':
|
||||
logging.basicConfig(
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.DEBUG)
|
||||
testsuite = unittest.TestLoader().loadTestsFromTestCase(BotTest)
|
||||
unittest.TextTestRunner(verbosity=1).run(testsuite)
|
||||
|
|
|
@ -7,7 +7,7 @@ import unittest
|
|||
|
||||
class BotTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
bot = telegram.Bot(token=os.environ.get('TOKEN'), debug=True)
|
||||
bot = telegram.Bot(token=os.environ.get('TOKEN'))
|
||||
self._bot = bot
|
||||
print('Testing the Bot API class')
|
||||
|
||||
|
|
Loading…
Reference in a new issue