Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Unknown qExec() in QtTest for Python testcases?
Forum Updated to NodeBB v4.3 + New Features

Unknown qExec() in QtTest for Python testcases?

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 175 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PowerNowP Offline
    PowerNowP Offline
    PowerNow
    wrote on last edited by
    #1

    Hi, I want to use QtTest for C++ and Python. In C++ I use

    #include <QtTest/QtTest>
    #include <Test/testcases.h>
    
    int main(int argc, char *argv[])
    {
        TestCases testcases;
        return QTest::qExec(&testcases, argc, argv);
    }
    

    and it works great. Unfortunately in Python it does not

    from PySide6.QtTest import QTest
    import testcases
    
    testcases = testcases.TestCases()
    QTest.qExec(testcases)
    

    and get the error

    AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'qExec'
    

    Although in the Qt Python docu stands

    qExec() can be used to execute all test functions in the test object.
    

    https://doc.qt.io/qtforpython/overviews/qtest-overview.html#miscellaneous-options

    What I'm doing wrong here? Thks...

    eyllanescE 1 Reply Last reply
    0
    • PowerNowP PowerNow

      Hi, I want to use QtTest for C++ and Python. In C++ I use

      #include <QtTest/QtTest>
      #include <Test/testcases.h>
      
      int main(int argc, char *argv[])
      {
          TestCases testcases;
          return QTest::qExec(&testcases, argc, argv);
      }
      

      and it works great. Unfortunately in Python it does not

      from PySide6.QtTest import QTest
      import testcases
      
      testcases = testcases.TestCases()
      QTest.qExec(testcases)
      

      and get the error

      AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'qExec'
      

      Although in the Qt Python docu stands

      qExec() can be used to execute all test functions in the test object.
      

      https://doc.qt.io/qtforpython/overviews/qtest-overview.html#miscellaneous-options

      What I'm doing wrong here? Thks...

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @PowerNow If you are going to implement test in python then it is better to use pytest-qt as it uses pytest + QtTest environment (internally): https://pypi.org/project/pytest-qt/

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved