sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26472
[Bug 1331976] [NEW] [request] get error while invoke unittest.main() --- cannot be used in Sikuli scripts
Public bug reported:
Run the sample code form unittest document in SikuliX IDE, get a SystemExit error:
[error] script [ test ] stopped with error in line 64
[error] SystemExit ( False )
But there is no such issue if run this unit test using TextTestRunner. Below is the sample code.
Anyone have any sugesstion?
import os
import sys
import subprocess
import random
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
#self.proc = subprocess.Popen("explorer", shell=True)
#wait(2)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
self.assertEqual(self.seq, range(10))
# should raise an exception for an immutable sequence
self.assertRaises(TypeError, random.shuffle, (1,2,3))
def test_choice(self):
element = random.choice(self.seq)
self.assertTrue(element in self.seq)
def test_sample(self):
with self.assertRaises(ValueError):
random.sample(self.seq, 20)
for element in random.sample(self.seq, 5):
self.assertTrue(element in self.seq)
def tearDown(self):
pass
if __name__ == '__main__':
# python -m unittest test
unittest.main()
# python -m unittest -v test
#suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
#unittest.TextTestRunner(verbosity=2).run(suite)
** Affects: sikuli
Importance: Medium
Assignee: RaiMan (raimund-hocke)
Status: In Progress
** Changed in: sikuli
Status: New => In Progress
** Changed in: sikuli
Importance: Undecided => Medium
** Changed in: sikuli
Assignee: (unassigned) => RaiMan (raimund-hocke)
** Changed in: sikuli
Milestone: None => 1.2.0
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1331976
Title:
[request] get error while invoke unittest.main() --- cannot be used in
Sikuli scripts
Status in Sikuli:
In Progress
Bug description:
Run the sample code form unittest document in SikuliX IDE, get a SystemExit error:
[error] script [ test ] stopped with error in line 64
[error] SystemExit ( False )
But there is no such issue if run this unit test using TextTestRunner. Below is the sample code.
Anyone have any sugesstion?
import os
import sys
import subprocess
import random
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
#self.proc = subprocess.Popen("explorer", shell=True)
#wait(2)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
self.assertEqual(self.seq, range(10))
# should raise an exception for an immutable sequence
self.assertRaises(TypeError, random.shuffle, (1,2,3))
def test_choice(self):
element = random.choice(self.seq)
self.assertTrue(element in self.seq)
def test_sample(self):
with self.assertRaises(ValueError):
random.sample(self.seq, 20)
for element in random.sample(self.seq, 5):
self.assertTrue(element in self.seq)
def tearDown(self):
pass
if __name__ == '__main__':
# python -m unittest test
unittest.main()
# python -m unittest -v test
#suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
#unittest.TextTestRunner(verbosity=2).run(suite)
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1331976/+subscriptions
Follow ups
References