mercredi 29 juillet 2015

Executing Unit Test with Jenkins on a Windows machine

I'm trying to run unit tests in a python project with Jenkins on a Windows machine. I tried creating a bat file to execute a python script but it doesn't work though the build says success. I try executing a python script where I'm creating a file to test as below:

import sys

sys.stdout=open("test.txt","w")

print ("hello")

but the file doesn't get created although the build is successful. If I execute the same file from my Command Prompt, I can see a file getting created. I also checked "Allow services to interact with desktop" in Jenkins service, still I'm unable to move forward. Any idea as to where I'm going wrong?

I'm using this package to explore Jenkins: http://ift.tt/1SNsaqA

The file that I run from my command prompt is http://ift.tt/1h5ZDAT

It runs well from my command prompt, but Jenkins is unable to execute it with the desired output. Nothing happens. If I copy paste the code from that file to the 'Execute Python Script' build step, I get a failure:

Traceback (most recent call last):
  File "C:\windows\TEMP\hudson4197938262305195993.py", line 15, in <module>
    from pystache.commands import test
ImportError: No module named pystache.commands
Build step 'Execute Python script' marked build as failure
Finished: FAILURE

I also checked(by echoing USERDOMAIN and USERNAME in the output) and it turns out to be my admin regular user

Any suggestions?

Aucun commentaire:

Enregistrer un commentaire