sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #40331
Re: [Question #292717]: python unittest discover in SikuliX
Question #292717 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/292717
tranquillo posted a new comment:
I try to use python unittest not to test my own functions, but to
organize the sikuli tests as unit test and serve after finish all tests
a unittest.xml. To make it most convenient for all test-writers i want
to organize all sikuli tests under the subfolder "tests" and the
unittest discover()-function should collect all available test into the
test-suite.
But, it seems, that sikuli and unittest work not very well together.
This is my directory structure:
unittest_boilerplate.sikuli
|-- unittest_boilerplate.py
|-- tests
| |-- test_progStart
| | |-- __init__.py
| | |-- test_progStart.py
The boilerplate script contains mostly the discover( )-function to get
the tests from the subfolder "tests". The "__init__.py" ist just an
empty file that is needed for the special kind of the discover()
function -> http://stackoverflow.com/questions/12674167/python-unittest-
discovery-with-subfolders
Like this structure as above discover() work very well and collect the
tests. But for the sikulix-ide its necessary that the subfolder
"test_progStart" has the ".sikuli" suffix, wich is a problem for
unittest:
progStart.sikuli.test_programStart (unittest.loader.ModuleImportFailure)
... ERROR
======================================================================
ERROR: progStart.sikuli.test_programStart (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: progStart.sikuli.test_programStart
Traceback (most recent call last):
File "C:\sikuli\sikulix.jar\Lib\unittest\loader.py", line 252, in _find_tests
module = self._get_module_from_name(name)
File "C:\sikuli\sikulix.jar\Lib\unittest\loader.py", line 230, in _get_module_from_name
__import__(name)
ImportError: No module named sikuli
----------------------------------------------------------------------
Is there any solution for this, or a workaround to use directorys as
modules in unittest together with sikulix?
Thanks
Rob
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.