<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: Candara;color: #000000">
Hi Florian. Thanks for the response. I was unaware of the model tester. Sounds very interesting. Unfortunately, my attempts to use it so far have been unrewarding.<div><br></div><div>First, I tried installing <span style="font-family: Consolas">pytest-qt</span> using <span style="font-family: Consolas">pip</span>. Following that, I am able to successfully import <span style="font-family: Consolas">pytestqt</span>. But if I try to import <span style="font-family: Consolas">pytestqt.modeltest</span>, I get this message:</div><div><br></div><div><div><span style="font-family: Consolas">>>> import pytestqt.modeltest</span></div><div><span style="font-family: Consolas;color: #c00000">Traceback (most recent call last):</span></div><div><span style="font-family: Consolas;color: #c00000"> File "<pyshell#3>", line 1, in <module></span></div><div><span style="font-family: Consolas;color: #c00000"> import pytestqt.modeltest</span></div><div><span style="font-family: Consolas;color: #c00000"> File "C:\Users\jfs\AppData\Local\Programs\Python\Python37\lib\site-packages\pytestqt\modeltest.py", line 55, in <module></span></div><div><span style="font-family: Consolas;color: #c00000"> HAS_QT_TESTER = hasattr(qt_api.QtTest, "QAbstractItemModelTester")</span></div><div><span style="font-family: Consolas;color: #c00000">AttributeError: '_QtApi' object has no attribute 'QtTest'</span></div><div><br></div><div>which I don't quite understand. :-/</div><div><br></div><div>Undaunted, I tried updating PyQt5 to 5.12.1 and using <span style="font-family: Courier New">QAbstractItemModelTester</span>. I put the following line in the test app:</div><div><br></div><div><div> <span style="font-family: Courier New"> tester = QtTest.QAbstractItemModelTester(dlg.model, QtTest.QAbstractItemModelTester.FailureReportingMode.Warning)</span></div></div><div><br></div><div>That didn't generate any output. The documentation says "<span style="font-size: 12pt;line-height: 1.5">In a </span><a href="https://doc.qt.io/qt-5/qtest-overview.html" style="font-size: 12pt;line-height: 1.5">test case</a><span style="font-size: 12pt;line-height: 1.5"> it is sufficient to create an instance, passing the model that needs to be tested to the constructor". So I guess it must be the case that I haven't properly created a test case. Still working on it ...</span></div><div><span style="font-size: 12pt;line-height: 1.5"><br></span></div><div><span style="font-size: 12pt;line-height: 1.5">/John</span></div><div><div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">On 5/3/2019 1:36:04 AM, Florian Bruhin <me@the-compiler.org> wrote:</p><div style="font-family:Arial,Helvetica,sans-serif">On Thu, May 02, 2019 at 10:25:38PM -0500, John F Sturtz wrote:
<br>> Any help or insight would surely be appreciated.
<br>
<br>You might want to try running pytest-qt's item model tester over your model:
<br>https://pytest-qt.readthedocs.io/en/latest/modeltester.html
<br>
<br>(I suppose with PyQt > 5.11 you can also use QtTest.QAbstractItemModelTester
<br>outside of pytest, but I never tried)
<br>
<br>It catches a lot of little issues with model implementations and (hopefully)
<br>tells you what's wrong.
<br>
<br>Florian
<br></div></blockquote></div></div></div>