os.symlink not working in sikuli

Asked by raghuveer

Hi,

We are working on attaching failure image in Html report.
We got latest html testrunner from below link:

https://gitorious.org/mobile-testing-framework/mobile-testing-framework/source/868173a5b5401c202c636fb2cf69b2f06db9136f:

After executing sikuli code we are getting following error

os.symlink(destPath,symPath)

AttributeError: 'module' object has no attribute 'symlink'

kindly help us to slove this issue.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

if it is only to use a HTMLTestRunner version, that works with Sikuli:
https://dl.dropboxusercontent.com/u/42895525/HTMLTestRunner.zip

If you need to run unittest2 (for which HTMLTestRunner2 was modified), then you have to give mor information on where the mentioned error happened.

Revision history for this message
raghuveer (raghu-veer) said :
#2

Hi RaiMan,

Thanks for your quick reply.

Following code we are executing in sikuli

import unittest2 as unittest
import HTMLTestRunner2 as HTMLTestRunner
reload(HTMLTestRunner)
import helpers
reload(helpers)
import os
import shutil

myPath=os.path.dirname(getBundlePath())
print myPath

class main_script(unittest.TestCase):
    def test01_script(self):
        try:
            print "python"
            print i
            #click("1382336023811.png")
        except:
            print "Fail"
            assert False

def main():
     helpers.loadConfig()
     reportfile = os.path.join(Settings.reportdir,"report.html")
     reportstream = open(reportfile,"w")
     runner = HTMLTestRunner.HTMLTestRunner(stream=reportstream,
                                             title="Test Report",
                                          description="Test Report from MobileTestingFramework",
                                         verbosity=1,
                                     fwSettings=Settings)
     runner.run(Settings.suite)
     reportstream.close()
     #generate the coverage report
     if Settings.isim_coverage:
         helpers.genCoverage("Total",Settings.app_sourcedir,Settings.reportdir,True)
if __name__ == '__main__':
    try:
        main()
    except AssertionError, e:
        print "ASSERTION ERROR" + str(e)

we have following modules in one folder
1.helpers.py,
2.HTML TestRunner.py
3.imageRepository.py
4. unittest2 modules

Following Error is occuring in helpers.py

\helpers.py", line 1042, in createSymlink
os.symlink(destPath,symPath)
AttributeError: 'module' object has no attribute 'symlink'.

Here our intention is to capture image as an attachment in Html report when testcase fails.
If any other solution is there please suggest me.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

The Jython os module (SikuliX version 1.0.1 uses Jython 2.5.4rc1) indeed does not have a symlink method.

So you have to ask the author of helpers.py, how this should work with Jython (and hence Sikuli).

Revision history for this message
raghuveer (raghu-veer) said :
#4

Hi RaiMan,

Thanks for your reply,
Author of helpers.py is "Andreas Kirchner"
As of now we don't have his email-id.
If you know his email-id please reply.

Thanks for your support.

Revision history for this message
RaiMan (raimund-hocke) said :
#5

I did not know his email either, but it was only 2 clicks away ;-)
on tab community got to owner and here you are.