Article - Using Squish functions in your own Python modules or packages

Skip to end of metadata
Go to start of metadata
The information in this article does not apply to the squishtest module. (See Using Squish as a module in other Python scripts, applications.)

Table of Contents

Overview

Here are several examples of how you can use your own Python modules in Squish.

The challenge with using the Squish functions and members in your own Python modules is this:

  • Squish functions and member are injected into the squish module at runtime after the test script has started/attached to an application.

This means that with a test script and custom module like these...

mymodule.py
mymodule.py

...the from import statement in the module mymodule will only import the functions and members that exist in the squish module at that point in time. Therefore the above may result in errors such as this:

Solution #1 - Access functions and members explicitly

test.py
mymodule.py

Note the added prefix squish. in three places in click_x() as well as click_y().

Solution #2 - "Custom" import of current functions and members

Requirements:

test.py
mymodule.py

Solution #3 - "Custom" import of current functions and members via decorator

Requirements:

test.py
mymodule.py

Related information

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.