← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #623013]: AttributeError ( 'module' object has no attribute 'test_TC1' )

 

Question #623013 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/623013

    Status: Open => Answered

RaiMan proposed the following answer:
name test_TC1 is not known in the scope of ScriptA, since it is defined
inside class A.

recommendation for setup and naming in the SikuliX context:

# ScriptA.sikuli
from sikuli import*
import unittest

ClassTestA(unittest.TestCase):

    def test_TC1(self):
        ##Some Code

#MainScript.sikuli
#from sikuli import * # not needed in mainscript

import ScriptA

# no longer needed with version 1.1.1 since auto reloaded internally
#reload(ScriptA)
#from ScriptA import *

import unittest
import HTMLTestRunner

suite = unittest.TestLoader().loadTestsFromTestCase(TestA)
outfile = open("C:\Sikuli Reports\A.html", "wb")
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='A Test Report', description='This is a Test Report' )
runner.run(suite)
outfile.close()

with SikuliX script runner there is no need for the main constructions.

#ScriptA.test_TC1()
this does not make any sense, since your tests are run with the HTMLTestRunner anyways.

generally: use version 1.1.1

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.