File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 3131import os
3232import sys
3333
34- __version__ = "0.4.0 "
34+ __version__ = "0.4.1 "
3535
3636# All unique members of Qt.py
3737__added__ = list ()
@@ -239,10 +239,18 @@ def init():
239239 )
240240
241241 for binding in bindings :
242- log ("Trying %s" % binding .__name__ [ 1 :] , verbose )
242+ log ("Trying %s" % binding .__name__ , verbose )
243243
244244 try :
245- sys .modules [__name__ ] = binding ()
245+ binding = binding ()
246+
247+ sys .modules .update ({
248+ __name__ : binding ,
249+
250+ # Fix #133, `from Qt.QtWidgets import QPushButton`
251+ __name__ + ".QtWidgets" : binding .QtWidgets
252+ })
253+
246254 return
247255
248256 except ImportError as e :
Original file line number Diff line number Diff line change @@ -32,20 +32,23 @@ def binding(binding):
3232 "--exe" ,
3333 ]
3434
35- # argv.extend(sys.argv[1:])
35+ errors = 0
3636
3737 # Running each test independently via subprocess
3838 # enables tests to filter out from tests.py before
3939 # being split into individual processes via the
4040 # --with-process-isolation feature of nose.
4141 with binding ("PyQt4" ):
42- subprocess .call (argv )
42+ errors += subprocess .call (argv )
4343
4444 with binding ("PySide" ):
45- subprocess .call (argv )
45+ errors += subprocess .call (argv )
4646
4747 with binding ("PyQt5" ):
48- subprocess .call (argv )
48+ errors += subprocess .call (argv )
4949
5050 with binding ("PySide2" ):
51- subprocess .call (argv )
51+ errors += subprocess .call (argv )
52+
53+ if errors :
54+ raise Exception ("%i binding(s) failed." % errors )
Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ def test_vendoring():
159159 ) == 0
160160
161161
162+ def test_import_from_qtwidgets ():
163+ """Fix #133, `from Qt.QtWidgets import XXX` works"""
164+ from Qt .QtWidgets import QPushButton
165+ assert QPushButton .__name__ == "QPushButton" , QPushButton
166+
167+
162168if binding ("PyQt4" ):
163169 def test_preferred_pyqt4 ():
164170 """QT_PREFERRED_BINDING = PyQt4 properly forces the binding"""
You can’t perform that action at this time.
0 commit comments