Changeset 140:28d2df4e855f
- Timestamp:
- 23/04/10 13:27:44 (22 months ago)
- Author:
- Menno Smits <menno@…>
- Branch:
- default
- Message:
-
#7: added new script for interactive sessions (interact.py)
Uses IPython if available.
Removed --interact from livetest.py
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r126
|
r140
|
|
| 8 | 8 | [API CHANGE] select_folder now returns a dictionary with the full |
| 9 | 9 | SELECT command response instead of just the message count (#24). |
| | 10 | |
| | 11 | Added interact.py, a script for interactive IMAPClient |
| | 12 | sessions. Useful for debugging and exploration. Uses IPython if |
| | 13 | installed. |
| 10 | 14 | |
| 11 | 15 | |
-
|
r85
|
r140
|
|
| 63 | 63 | The code is well documented. See the docstrings for more usage information. |
| 64 | 64 | |
| | 65 | |
| | 66 | interact.py |
| | 67 | ----------- |
| | 68 | This script connects an IMAPClient instance using the command line |
| | 69 | args given and starts an interactive session. This is useful for |
| | 70 | exploring the IMAPClient API and testing things out, avoiding the |
| | 71 | steps required to set up an IMAPClient instance. |
| | 72 | |
| | 73 | The IPython shell is used if it is installed. Otherwise the |
| | 74 | code.interact() function from the standard library is used. |
| | 75 | |
| | 76 | |
| 65 | 77 | livetest.py |
| 66 | 78 | ----------- |
-
|
r139
|
r140
|
|
| 406 | 406 | default=False, help='These tests are destructive. Use this ' |
| 407 | 407 | 'option to bypass the confirmation prompt.') |
| 408 | | p.add_option('', '--interact', dest='interact', action='store_true', |
| 409 | | default=False, |
| 410 | | help='Instead of running tests, set up the connection & drop into a shell') |
| 411 | 408 | |
| 412 | 409 | options, args = p.parse_args() |
| … |
… |
|
| 446 | 443 | client = imapclient.IMAPClient(options.host, use_uid=use_uid, ssl=options.ssl) |
| 447 | 444 | client.login(options.username, options.password) |
| 448 | | if options.interact: |
| 449 | | import code |
| 450 | | code.interact('HAI! IMAPClient instance is "c"', local=dict(c=client)) |
| 451 | | break |
| 452 | | else: |
| 453 | | runtests(client) |
| 454 | | print 'SUCCESS' |
| | 445 | runtests(client) |
| | 446 | print 'SUCCESS' |
| 455 | 447 | |
| 456 | 448 | if __name__ == '__main__': |