Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement #105 #120

Merged
merged 10 commits into from
Aug 30, 2016
Merged

Implement #105 #120

merged 10 commits into from
Aug 30, 2016

Conversation

mottosso
Copy link
Owner

Here's one way of achieving #105.

  1. Generate a dictionary of every member in PySide2.
  2. For each other binding, compare available members with those
  3. A member available in PySide2, but not in another, that is a bug.

Some problems include (1), PySide2 not yet being complete, so things like QtOpenGL is missing and (2) PySide2 including quite a few unique members compared to PyQt5, which should theoretically be quite similar.

Example output

Here's what I got in this initial commit.

======================================================================
FAIL: test_membership.test_PyQt5_members
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/workspace/Qt.py/test_membership.py", line 37, in test_PyQt5_members
    assert not missing, "PyQt5 has missing members: %s" % message
AssertionError: PyQt5 has missing members:
QtWebKit:
 - WebCore
 - __doc__
 - __file__
 - __name__
 - __package__
QtCore:
 - ClassInfo
 - Connection
 - MetaFunction
 - QBasicMutex
 - QFactoryInterface
 - QJsonArray
 - QT_TRANSLATE_NOOP3
 - QT_TRANSLATE_NOOP_UTF8
 - SIGNAL
 - SLOT
 - __moduleShutdown
 - __version__
 - __version_info__
 - qAcos
 - qAsin
 - qAtan
 - qAtan2
 - qExp
 - qFabs
 - qFastCos
 - qFastSin
 - qFuzzyIsNull
 - qTan
 - qtTrId
QtGui:
 - QAccessibleEvent
 - QMatrix
 - QPyTextObject
 - QStringListModel
 - QToolBarChangeEvent
QtScript:
 - QScriptClass
 - QScriptClassPropertyIterator
 - QScriptContext
 - QScriptContextInfo
 - QScriptEngine
 - QScriptEngineAgent
 - QScriptExtensionInterface
 - QScriptExtensionPlugin
 - QScriptProgram
 - QScriptString
 - QScriptValue
 - QScriptValueIterator
 - QScriptable
 - __doc__
 - __file__
 - __name__
 - __package__
QtNetwork:
 - QIPv6Address
-------------------- >> begin captured stdout << ---------------------
Trying pyqt5
--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_membership.test_PyQt4_members
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/workspace/Qt.py/test_membership.py", line 69, in test_PyQt4_members
    assert not missing, "PyQt4 has missing members: %s" % message
AssertionError: PyQt4 has missing members:
QtWebKit:
 - WebCore
QtCore:
 - ClassInfo
 - Connection
 - MetaFunction
 - QAbstractProxyModel
 - QBasicMutex
 - QFactoryInterface
 - QFileDevice
 - QItemSelectionRange
 - QJsonArray
 - QJsonDocument
 - QJsonParseError
 - QJsonValue
 - QMessageLogContext
 - QSortFilterProxyModel
 - QT_TRANSLATE_NOOP3
 - QT_TRANSLATE_NOOP_UTF8
 - QtInfoMsg
 - __moduleShutdown
 - __version__
 - __version_info__
 - qAcos
 - qAsin
 - qAtan
 - qAtan2
 - qExp
 - qFabs
 - qFastCos
 - qFastSin
 - qFuzzyIsNull
 - qInstallMessageHandler
 - qTan
 - qtTrId
QtGui:
 - QAccessibleEvent
 - QGuiApplication
 - QPagedPaintDevice
 - QSurface
 - QSurfaceFormat
 - QToolBarChangeEvent
 - QTouchDevice
 - QWindow
QtScript:
 - QScriptExtensionInterface
 - QScriptExtensionPlugin
 - QScriptProgram
 - QScriptable
QtNetwork:
 - QIPv6Address
-------------------- >> begin captured stdout << ---------------------
Trying pyqt4
--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: test_membership.test_PySide_members
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/workspace/Qt.py/test_membership.py", line 101, in test_PySide_members
    assert not missing, "PySide has missing members: %s" % message
AssertionError: PySide has missing members:
QtCore:
 - Connection
 - QAbstractProxyModel
 - QBasicMutex
 - QFileDevice
 - QItemSelectionRange
 - QJsonArray
 - QJsonDocument
 - QJsonParseError
 - QJsonValue
 - QMessageLogContext
 - QtInfoMsg
 - qInstallMessageHandler
QtGui:
 - QGuiApplication
 - QPagedPaintDevice
 - QSurface
 - QSurfaceFormat
 - QTouchDevice
 - QWindow

@mottosso
Copy link
Owner Author

Missed the most important file!

I also renamed the builders, because they were getting run during testing due to their name containing the magic word "test".
Without these lines, tests may look within any Python file and throw errors unrelated to tests (in this case, SyntaxError in Python 3 for file(s) produced by build_membership.py).
@fredrikaverpil
Copy link
Collaborator

This is nice. I'm checking the code out now.

@fredrikaverpil
Copy link
Collaborator

I've never seen the use of from PySide2 import __all__ before. Nice one, since import * doesn't work!

f.write(contents)


# Don't consider these members
Copy link
Collaborator

@fredrikaverpil fredrikaverpil Aug 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind expanding this comment on why these are not considered members?

Is it because they are either internals (__something__) or binding-specific (doesn't have an equivalent in PySide2)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is it because these have no no Qt4-equivalent?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment.

@fredrikaverpil
Copy link
Collaborator

Good job! This is an awesome addition to the project @mottosso 😀

Have you seen that the Travis CI tests output looks a bit garbled?
https://travis-ci.org/mottosso/Qt.py/jobs/156129566#L2916-L2927

@mottosso
Copy link
Owner Author

Have you seen that the Travis CI tests output looks a bit garbled?

That's the generated membership test. I figure, for now, it might be worth keeping an eye on exactly how it's working since it's a bit ad-hoc.

@mottosso
Copy link
Owner Author

Ok, it's not perfect, but will do for a first pass.

Let's keep it in mind for future improvements and corrections; in particular about including members as they become available through PySide2.

@fredrikaverpil
Copy link
Collaborator

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants