sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04508
[Bug 824185] Re: IndexError in unittest.main()
When running a script in the IDE that uses the unit test module, you
cannot use unittest.main(), you have to use
suite = unittest.TestLoader().loadTestsFromTestCase(TestClass)
unittest.TextTestRunner().run(suite)
to run your tests.
Only when running a script from command line, sys.argv is populated as
expected.
So to be consistent, do not use unit test.main() generally.
** Summary changed:
- IndexError in unittest.main()
+ X-1.0rc2: IDE: unittest.main() not usable - sys.argv is empty --- workaround
** Description changed:
+ *** workaround:
+ see comment #1
+ ---------------------------------
+
If using the unittest module in the Sikuli IDE, it will fail after
calling unittest.main() with this backtrace.
[error] Error message: Traceback (most recent call last):
File "C:\DOCUME~1\JSTERN~1\LOCALS~1\Temp\sikuli-tmp6357708907197010851.py", line 28, in
- unittest.main()
+ unittest.main()
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\unittest.py", line 766, in __init__
IndexError: index out of range: 0
That line is:
- self.progName = os.path.basename(argv[0])
+ self.progName = os.path.basename(argv[0])
It just looks like Sikuli isn't passing the program name as the first
argument and the unittest module wants that.
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/824185
Title:
X-1.0rc2: IDE: unittest.main() not usable - sys.argv is empty ---
workaround
Status in Sikuli:
New
Bug description:
*** workaround:
see comment #1
---------------------------------
If using the unittest module in the Sikuli IDE, it will fail after
calling unittest.main() with this backtrace.
[error] Error message: Traceback (most recent call last):
File "C:\DOCUME~1\JSTERN~1\LOCALS~1\Temp\sikuli-tmp6357708907197010851.py", line 28, in
unittest.main()
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\unittest.py", line 766, in __init__
IndexError: index out of range: 0
That line is:
self.progName = os.path.basename(argv[0])
It just looks like Sikuli isn't passing the program name as the first
argument and the unittest module wants that.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/824185/+subscriptions
References