psgtest
Test Python Programs Using Numerous Python Versions
Installation
python -m pip install psgtest
or
python3 -m pip install psgtest
GitHub Repo Location
https://github.com/PySimpleGUI/psgtest
Launching
From the command line:
psgtest
You can also use the psgshortcut
utility to make a double-clickable shortcut icon for Windows that can also be pinned to the Taskbar.
"Authored in, but not limited to PySimpleGUI"
Like many of the utilities that have been released as part of the PySimpleGUI project, they were developed using PySimpleGUI, but their use is not limited to PySimpleGUI-based project. psgtest
is a good example of this.
psgtest
was written in PySimpleGUI, but the programs you are using it to launch do not have to be written using PySimpleGUI. They can be any Python program.
How to Use - Simple Search, Edit or Execute
The interface for psgtest
is very similar to the Demo Browser. There is a list of Python files on the left and on the right is where text output is shown. Like the Demo Browser you can "point" the tool at any top of a tree of source files and the will be presented to you in a single list.
Filtering (searching)
You can filter the list (search for files with a string in their filename) by typing into the Input that has the text label "Filter(F1):". Pressing the F1 key will move the cursor to this input. As you type characters, the list of files is updated in real-time. The idea is that you type characters until you get the list you're looking for.
For example, maybe you want to see only files with "button" in the title. You would enter "button" in the Filter input. The result will be a shorter list than your original unfiltered list.
Running Programs
Highlighting one or more files from the list and then clicking the "Run" button will run all of the selected files immediately.
Program Output (Stdout and Stderr)
A tab will be created that shows the stdout and stderr output from the program being executed. In this example, the Demo_Button_Toggle.py file was selected and run. The output is shown in a tab matching the name of the file.
Notice that each of the output tabs can be click clicked and closed.
Running Multiple Programs
Unsurprisingly, if you select multiple files from the file list and click "Run" a tab will be created for each program. Here 2 programs were run and 2 matching tabs created that contain their outputs.
Multiple Python Versions
Enabling the execution of programs using specific versions of Python is the reason this program was originally written. PySimpleGUI needs to run on all versions of Python from 3.4 to 3.11 and beyond.
Setting up the location of each interpreter is done though the "Settings" window that you can access from the main screen.
Once the interpreters are set up, switching between them is as easy changing the combobox on the main screen.
In this example, we see a program being run on 3.6 and 3.9.
Stress and Regression Testing
A simple stress and regressing feature is accessible using the the controls in the bottom left of the window. Here you can run batches of programs and control the number of them that are executed simultaneously. For example, maybe you have 50 programs to test.
However, 50 programs simultaneous (1) is not a likely real-world situation and (2) may have a significant performance impact. For this reason there is a "Run X programs at a time" setting.
There is also an option to stress test by running several iterations of tests.