Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1882)

Side by Side Diff: third_party/twisted_8_1/twisted/test/app_qtstub.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2006 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 L{twisted.test.test_application.PluggableReactorTestCase.test_qtStub} uses
6 this helper program to test that when the QT reactor plugin is not
7 available, an attempt to select it via the deprecated name C{qt} fails
8 appropriately.
9
10 When installation fails, no output is produced. When it succeeds, a message
11 is printed.
12 """
13
14 import sys
15
16 from twisted.application import reactors
17
18
19 class QTNotImporter:
20 """
21 Import hook which unilaterally rejects any attempt to import
22 C{qtreactor} so that we can reliably test the behavior of attempting to
23 install it when it is not present.
24 """
25 def find_module(self, fullname, path):
26 """
27 Reject attempts to import C{qtreactor}. Ignore everything else.
28 """
29 if fullname == 'qtreactor':
30 raise ImportError('qtreactor does not exist!')
31
32
33
34 def main():
35 """
36 Try to install the reactor named C{qt}. Expect it to not work. Print
37 diagnostics to stdout if something goes wrong, print nothing otherwise.
38 """
39 sys.meta_path.insert(0, QTNotImporter())
40 try:
41 reactors.installReactor('qt')
42 except reactors.NoSuchReactor, e:
43 if e.args != ('qt',):
44 print 'Wrong arguments to NoSuchReactor:', e.args
45 else:
46 # Do nothing to indicate success.
47 pass
48 else:
49 print 'installed qtreactor succesfully'
50 sys.stdout.flush()
51
52 if __name__ == '__main__':
53 main()
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/test/__init__.py ('k') | third_party/twisted_8_1/twisted/test/crash_test_dummy.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698