draperjames / qtpandas

Qt Meets Pandas
MIT License
140 stars 53 forks source link

Sip import fix #30

Open draperjames opened 7 years ago

draperjames commented 7 years ago

@zbarge try testing out this fork when you get the chance and let me know how it work for you. I haven't had any problems.

zbarge commented 7 years ago

OK about to test now.

draperjames commented 7 years ago

If anything breaks in your env would you mind listing it here?

zbarge commented 7 years ago

It works OK for me - i get 9 failed tests though and "cannot import sip" still

zbarge commented 7 years ago

test accept/reject for CSVDialogs:

qapp = <PySide.QtGui.QApplication object at 0x00000000069AAE08> request = <SubRequest 'qtbot' for <Function 'test_accept_reject'>>

@pytest.yield_fixture
def qtbot(qapp, request):
    """
    Fixture used to create a QtBot instance for using during testing.

    Make sure to call addWidget for each top-level widget you create to ensure
    that they are properly closed after the test ends.
    """
    result = QtBot(qapp)
    no_capture = request.node.get_marker('qt_no_exception_capture') or \
                 request.config.getini('qt_no_exception_capture')
    if no_capture:
        yield result  # pragma: no cover
    else:
        with capture_exceptions() as exceptions:
            yield result
        if exceptions:
          pytest.fail(format_captured_exceptions(exceptions))

E Failed: Qt exceptions in virtual methods: E ____ E File "C:\Users\Zeke\Google Drive\dev\python\qtpandas\qtpandas\views\CSVDialogs.py", line 657, in rejected E self.exported.emit(False) E
E TypeError: Value types used on meta functions (including signals) need to be registered on meta type: QBool E ____

zbarge commented 7 years ago

same test accept reject

Traceback (most recent call last): File "C:\Users\Zeke\Google Drive\dev\python\qtpandas\qtpandas\views\CSVDialogs.py", line 657, in rejected self.exported.emit(False) TypeError: Value types used on meta functions (including signals) need to be registered on meta type: QBool F self = <tests.test_CSVDialogs.TestCSVExportWidget object at 0x00000000067F15F8> qtbot = <pytestqt.plugin.QtBot object at 0x00000000067F1198>

def test_accept_reject(self, qtbot):
    csvwidget = CSVExportDialog()
    qtbot.addWidget(csvwidget)
    csvwidget.show()

    buttons = csvwidget.findChildren(QtGui.QPushButton)
    for button in buttons:
        qtbot.mouseClick(button, QtCore.Qt.LeftButton)
        if button.text() == 'Export Data':
            assert csvwidget.isVisible() == True
        else:
          assert csvwidget.isVisible() == False

E assert True == False E + where True = <built-in method isVisible of CSVExportDialog object at 0x0000000006807048>() E + where <built-in method isVisible of CSVExportDialog object at 0x0000000006807048> = <qtpandas.views.CSVDialogs.CSVExportDialog object at 0x0000000006807048>.isVisible

test_CSVDialogs.py:269: AssertionError

zbarge commented 7 years ago

F def test_TimestampFormat(): model = DataFrameModel() assert model.timestampFormat == Qt.ISODate newFormat = "yy-MM-dd hh:mm" model.timestampFormat = newFormat assert model.timestampFormat == newFormat

    with pytest.raises(TypeError) as excinfo:
      model.timestampFormat = "yy-MM-dd hh:mm"

E Failed: DID NOT RAISE <class 'TypeError'>

test_DataFrameModel.py:66: Failed

draperjames commented 7 years ago

Okay try to do a fresh install of this last commit. I managed to get all of the tests to at least open at last count I have 5 failed, 147 passed, 2 errors.

zbarge commented 7 years ago

I just fetched the latest and im testing it now and failing 9/154.

I think we should change the signals to regular python types, right now there are strings like the following:

Line 501 qtpandas/qtpandas/views/CSVDialogs.py exported = Signal('QBool')

I want to change 'QBool' to bool on all the signals. Do you know any reason why I shouldn't do that?

Error in test:

E ____ E File "C:\Users\Zeke\Google Drive\dev\python\qtpandas\qtpandas\views\CSVDialogs.py", line 657, in rejected E self.exported.emit(False) E
E TypeError: Value types used on meta functions (including signals) need to be registered on meta type: QBool

draperjames commented 7 years ago

The only reason I can think is that Qbool might be some kind of C++ implementation of a bool. IDK go ahead and try it. I'll poke around and see what I can find about Qbool.

draperjames commented 7 years ago

Yeah it has worked pretty well for me. I also went back to the original pandas-qt repo and installed it in a python27 env, ran pytest on tests, it hit error pretty early on in in the cycle and exited pytest. So now I'm thinking that I either cocked-up the install or we have actually made some real improvements!