Running pytest on UI from command line?

   1374   1   1
User Avatar
Member
4 posts
Joined: Aug. 2014
Offline
Hi all -

I'm working on putting together pytest suites for some of our in-house tools, and I'm having a devil of a time doing it with Houdini.

Our general methodology has been:
- Create a vanilla Docker container with the bare minimum needed to test;
- Start a virtual frame buffer using xvfb;
- Run pytest on a commandline version of the DCC's python (e.g. hython).

While this allows us to run non-UI-related tests (we can test that our 'general controller' code can open/close/import/etc), even basic stuff inside Houdini (i.e. "can we open a window? is it the right size?") causes it to crash in a way we've not seen with Maya or Nuke. Opening up hython and running this:

>>> import sys
>>> from PySide2 import QtWidgets
>>> QtWidgets.QApplication(sys.argv)

...will cause hython to crash and exit -- unfortunately, in such a way that pytest fails, but does not capture the failure as output.

Has anyone had any luck in running Houdini UI tests from the command line? We're at the point of just tossing out this part of our test suite, and trusting that anything we do in vanilla command-line qt will translate over seamlessly to Houdini using our Houdini-specific window/panel boilerplate (which we can't test).
Edited by jasonporath - May 12, 2021 14:57:52
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
I had the same question and support suggested:

houdini -foreground script.py

And if your test needs to query or manipulate the Houdini UI, then:
houdini -foreground waitforui script.py

Also, we normally set these environment variables beforehand for testing purposes:
- HOUDINI_DISABLE_CONSOLE=1
- HOUDINI_NO_SPLASH=1
- HOUDINI_DISABLE_BACKGROUND_HELP_INDEXING=1
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
  • Quick Links