Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win Tests fail: dataLoadThread sometimes destroyed before thread.finished() #20

Open
tlambert03 opened this issue Sep 29, 2017 · 1 comment

Comments

@tlambert03
Copy link
Contributor

Not completely sure what's happening yet, but I'm making progress figuring out why the tests are failing on windows:

The failing test is just tests/test_datamodel/test_folder(). skip that test and the tests pass.
Looks like the problem is caused when DataModel.loadFromPath() calls setContainer(), which starts the DataLoadThread QThread. I'm not exactly sure where the error then happens, but if _dataSourceChanged is emitted or setPos(0) is called before the thread is done, you get the QThread deletion error on windows that fails the tests...

If I add a thread.finished.connect slot to the method, (as shown below), the tests/test_datamodel/ tests will pass... but then I get a
AttributeError: 'DataModel' object has no attribute 'pos' error on spimagine/gui/mainwidget.py line 575:

def setContainer(self, dataContainer=None, prefetchSize=0):
        self.dataContainer = dataContainer
        self.prefetchSize = prefetchSize
        self.nset = [0]
        self.data = defaultdict(lambda: None)

        if self.dataContainer:
            def onThreadDone():
                self.setPos(0)
                self._dataSourceChanged.emit()
            self.stopDataLoadThread()
            self.dataLoadThread.load(self.nset, self.data, self.dataContainer)
            self.dataLoadThread.finished.connect(onThreadDone)
            self.dataLoadThread.start(priority=QtCore.QThread.LowPriority)

so in short, I don't have a global solution, since I don't quite understand the data loading / prefetching well enough yet. But that's a start...

@tlambert03
Copy link
Contributor Author

it's also perhaps worth pointing out that it would be enough for now to just comment out or add a @nottest decorator to the test_datamodel/test_folder() test to allow the tests to pass while this is figured out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant