diff options
author | Friedemann Kleint <[email protected]> | 2025-07-11 08:14:34 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2025-07-11 13:45:29 +0200 |
commit | 92e85c597365f4e61aae44cbbd38eb2c23c1a719 (patch) | |
tree | 1fff89f16f5b1105ae282b8cbc8bad96ab1f9810 | |
parent | de6f09b99c8199241279212d5fffa635fef0fd39 (diff) |
Potential fix for stabilizing QtRemoteObjects cpp_interop test
The test sometimes fails, reporting an empty URL. Change the harness
to use stdout for printing the URL so that the flushing can be
controlled.
Amends 19abd816e73bebdd489408d0a3b7676822bff39c.
Pick-to: 6.9
Task-number: PYSIDE-862
Change-Id: Ie85ad5a4eb092f91add01905b711ff1db86e3a8f
Reviewed-by: Shyamnath Premnadh <[email protected]>
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
-rw-r--r-- | sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop.cpp | 3 | ||||
-rw-r--r-- | sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop_test.py | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop.cpp b/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop.cpp index 6aeef91dd..8cef3c795 100644 --- a/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop.cpp +++ b/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop.cpp @@ -72,7 +72,8 @@ public: } m_node.setObjectName("cpp_node"); - std::cerr << "harness: Host url:" << m_host.hostUrl().toEncoded().constData() << '\n'; + std::cout << "harness: Host url:" << m_host.hostUrl().toEncoded().constData() << '\n'; + std::cout.flush(); } public slots: diff --git a/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop_test.py b/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop_test.py index d9ab60c23..2ae4ffb58 100644 --- a/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop_test.py +++ b/sources/pyside6/tests/QtRemoteObjects/cpp_interop/cpp_interop_test.py @@ -27,6 +27,9 @@ from helper.usesqapplication import UsesQApplication """ +This test needs to be run from the build directory in +order to locate the harness binary. + The previous tests all verify Remote Objects integration, but only using Python for both Source and Replica. We need to make sure there aren't any surprises in the interplay between Python and C++. @@ -94,7 +97,7 @@ class Controller(QObject): # Start the C++ application self.process = QProcess() self.process.readyReadStandardOutput.connect(self.process_harness_output) - self.process.readyReadStandardError.connect(self.process_harness_output) + self.process.readyReadStandardError.connect(self.process_harness_stderr_output) urls = self.host.hostUrl().toDisplayString() print(f'Starting C++ application "{self._executable}" "{urls}"', file=sys.stderr) self.process.start(self._executable, [self.host.hostUrl().toDisplayString(), "Simple"]) @@ -134,18 +137,23 @@ class Controller(QObject): return source, replica def process_harness_output(self): - '''Process stderr from the C++ application''' - output = self.process.readAllStandardError().trimmed() + '''Process stdout from the C++ application, parse for URL''' + output = self.process.readAllStandardOutput().trimmed() lines = output.data().decode().split("\n") HOST_LINE = "harness: Host url:" for line in lines: - print(line, file=sys.stderr) + print(" stdout: ", line, file=sys.stderr) if line.startswith(HOST_LINE): urls = line[len(HOST_LINE):].strip() print(f'url="{urls}"', file=sys.stderr) self.cpp_url = QUrl(urls) self.ready.emit() + def process_harness_stderr_output(self): + '''Print stderr from the C++ application''' + output = self.process.readAllStandardError().trimmed() + print(" stderr: ", output.data().decode()) + class HarnessTest(UsesQApplication): def setUp(self): |