aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-03-19 10:30:29 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-05-09 11:32:52 +0000
commit43451e3bc17467593df64cb73ce8c0bf9e60045f (patch)
tree00f85921652ffcd15d1d7fb1be4b8519462364ac /sources/pyside2/tests
parent9dc1aa57dfbf9c684e5c75451dd028b88099c348 (diff)
Fix QSocketNotifier constructor
The first argument was modified to be a socket type, but it needs to be an int (file descriptor). Adding a new signature solves the compatibility problem between Python2 and 3. A test case was added. Task-number: PYSIDE-629 Change-Id: Id9dea37459350dfc90d0f0ab9e2e1993d03fe6e4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtCore/qsocketnotifier_test.py59
2 files changed, 60 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index 3a08cb45b..bc83aec7a 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -90,6 +90,7 @@ PYSIDE_TEST(qregularexpression_test.py)
PYSIDE_TEST(qresource_test.py)
PYSIDE_TEST(qsize_test.py)
PYSIDE_TEST(qslot_object_test.py)
+PYSIDE_TEST(qsocketnotifier_test.py)
PYSIDE_TEST(qsrand_test.py)
PYSIDE_TEST(qstandardpaths_test.py)
PYSIDE_TEST(qstatemachine_test.py)
diff --git a/sources/pyside2/tests/QtCore/qsocketnotifier_test.py b/sources/pyside2/tests/QtCore/qsocketnotifier_test.py
new file mode 100644
index 000000000..cd7676cef
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qsocketnotifier_test.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+'''Unit tests for QUuid'''
+
+import unittest
+
+from PySide2.QtWidgets import QApplication
+from PySide2.QtCore import QSocketNotifier
+import socket
+import sys
+import os
+
+class QSocketNotifierTest(unittest.TestCase):
+ def testClass(self):
+ app = QApplication([])
+ # socketpair is not available on Windows
+ if os.name != "nt":
+ w_sock, r_sock = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
+
+ self.assertIsInstance(r_sock.fileno(), int)
+
+ notifier = QSocketNotifier(r_sock.fileno(), QSocketNotifier.Read)
+
+ self.assertIsNotNone(notifier)
+
+ w_sock.close()
+ r_sock.close()
+
+
+if __name__ == '__main__':
+ unittest.main()