Running remote windows GUI application through ssh - python

I'm using py.test to run a series of python scripts that test an external windows GUI application.
I'm trying to run these tests on a remote ssh-enabled windows machines using fabric (using Bitvise SSH server on the remote end) but of course the tests which require GUI access fail.
I know that py.test has a package called xdist, but I guess it will suffer from the same problem if the channel we use is SSH.
Has anybody solved the issue of running remote GUI applications in Windows through SSH? SSH has been quite convenient for me to run remote deployment commands, and it would logically follow that py.test would be one of such commands.

Related

Execution of python code on remote machines

I'm building a testing suite using Python Pytest library,
my challenge is that I want to run the test on remote windows machines without the overhead of deploying my python code on those remote machines.
Current Solution:
Using Jenkins I'm cloning the tests repository from bit bucket to the remote machine , and then using a PowerShell command through WINRM triggering the execution of the pytest script on the remote machine.
Desired Solution:
The pytest code/repository will reside on a machine (local/cloud) and will execute on remote windows machines (possibly in parallel on multiple machines)
I've investigated the paramiko/factory packages but they both require the code to be present on the remote machines.
Anyone encountered similar requirement ? implemented something similar?
you can try a pub-sub mechanism with aws ssm

run python script in DigitalOcean

I'm having troubles to run a python script in DigitalOcean.
I have two doubts.
How to upload the scripy.py to DigitalOcean droplet.
How to run the script.
I'm able to access to the console, but further that I don't know what to do and i can't find any specific information on internet.
I'm running a Ubuntu 14.4 Droplet through web.
Ok first, in order to upload any file to your droplet you can user the command scp
scp foobar.txt your_username#remotehost.edu:/some/remote/directory
Here is a related question that shows you how to use scp from Windows.
Then in the console setup in the remote host check if you can run the command python. If you do not have it, just follow the steps in the documentation and you will have python running inside your remote machine.
If you put a Python script on the server and ssh in, you can run it from the command line. For instance,
python yourFantasticScript.py
If you want a level of automation to triggering the script to run, you will need to learn more about automation scheduling and server technologies.

pyqt test suite fails mysteriously with Jenkins, works flawlessly from Windows command shell

(note I doubt this is specific to PyQt so I've tagged with Qt too)
We have a 2 test suites (call them A and B) that we run with pytest on our dev workstations:
python -m pytest -c configfile -s -v A
python -m pytest -c configfile -s -v B
Suite B (and only that one) tests our PyQt components; A doesn't have any PyQt in it. We defined project A in Jenkins (version 1.658 btw) to run Suite A: it runs without issue in Jenkins. We did the same, defined a project B in Jenkins to run Suite B: this one fails intermittently after many tests, with a SYSTEM log message and a WARNING log message from Qt (caught by setting a handler via QtCore.qInstallMessageHandler()). The Jenkins log that captures the test suite B's stdout is:
SYSTEM log message from Qt: WindowCreationData::create: CreateWindowEx failed (Not enough storage is available to process this command.)
WARNING log message from Qt: Failed to create platform window for QWidgetWindow(0x705d260, name="FramedPartWidgetWindow") with flags QFlags<Qt::WindowType>(Window|WindowTitleHint|WindowSystemMenuHint|WindowMinMaxButtonsHint|WindowCloseButtonHint|WindowFullscreenButtonHint) (context: category=default)
Build step 'Execute Windows batch command' marked build as failure
The last line is output by Jenkins script running test suite B.
On the Jenkins machine (a Windows 7 Pro 64-bit platform, btw) that runs the test suites, I can open a Windows command shell and if I run the test suites from there, both test suites run without issue. Then I open a web browser, go to the Jenkins project page for suite B and click "Build now": this runs the same thing I ran from command shell, but I get the above error. If I do 10 builds, the above will happen for a different test every time, although always in the same "area". If I filter out the tests in the vicinity of where the failure occurred, the test runs further, but after removing 4 test classes this way, this no longer helps.
The issue is not desktop, because I am logged in. One difference between the command shell run vs the Jenkins run is that from shell, test suite B opens many (PyQt) windows and closes them. From Jenkins, I can't see any windows open so they seem to be opening in some "virtual" desktop. So maybe the issue the desktop. Do I need to somehow configure that virtual desktop to have larger graphics capacity?
The error seems to indicate that the process started by Jenkins is running out of some resource, but it's not clear what: there is plenty of drive space and memory.
Anyone have any idea where to go from here? I did a google search and all I could find is these, they don't look too promising although I will try the suggestions:
Developer Central
Not enough storage is available to process this command
Win32Exception Not enough storage is available to process this command
I'm not familiar with the intricacies of how the Jenkins service on Windows runs processes, so I'm at a loss.
Update 20161219: Apparently this is a known issues with GUI testing from Windows services, see my post on Bitnami Jenkins forum.
Apparently this is a known issues with GUI testing from Windows services, see my post on Bitnami Jenkins forum, as is the case with the bitnami jenkins stack we use. As I mention in that post, the bottom of the page https://wiki.jenkins-ci.org/display/JENKINS/Tomcat says GUI testing in Windows is not likely to work when Jenkins is installed using Tomcat as a container installed as a service. The only option seems to be to setup Tomcat to run using the Windows Scheduler (instead of a service), but unfortunately the bitnami stack we use for jenkins does not seem to allow this, so the only solution for us is to install jenkins from scratch and tomcat as a scheduled task.
It appears that on Windows (based on docs for setting up Jenkins to test GUI via Squish),
Install Jenkins master (this should be doable via bitnami stack in a Linux VM)
Install Windows slave. Make sure to not start the slave as Windows Service at Launch method. Windows Services are intended to run command line applications but not to run applications which consist of a GUI. Starting the Jenkins slave as JNLP via Launch slave agents via Java Web Start works fine.
Setup a node inside Jenkins at Manage Jenkins|Manage Nodes|New Node.
Read https://kb.froglogic.com/display/KB/Automation+on+Windows
This page seems to aggregate several posts related to this issue.

Configuring an external launcher for Eclipse over SSH with pydev

Hoping that this is the right place to ask this:
I have my Eclipse-Python IDE with PyDev on my windows machine.
My codes/project files are on my Rasp-Pi (Remote machine)
I connect the Eclipse with "Remote System Explorer" Addon via SSH.I can work on the remote code and execute it over the SSH-Terminal (or Putty) so far it works good.
Now I fail at configuring a remote launcher for the project. I just want to run/debug project within Eclipse-IDE (i.e. just via shortcut-key F11) and the Remote machine (Rasp-Pi) executes the code and does stuff.
I dream about a configuration field like
(ssh pi#0.00.00.00 &) python %1
EDIT
I am able to run my script remotely via a command prompt. All I want to do is to run the scripts with the standard launcher of eclipse configuring it, see pics.

ssh - execute a gtk python app over remote ssh?

I'm writing a gtk python app that I'm testing on an ubuntu laptop, however I'm writing the script on my win7 desktop (sftp to update the script the laptop).
If I try to execute the script via SSH such as:
python /path/to/app.py
It gives me errors since obviously gtk won't render a window in putty such as:
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
My question is, is there a way to execute the script via remote ssh that will open fine on the laptop? Its kind of a pain to have to save the script, then lean over and execute the script on the laptop.
Does anyone have any ideas how to do this?
Install a X server on your Windows 7: http://sourceforge.net/projects/xming/
Then, don't forget to do ssh -X when you start the remote script.

Categories

Resources