[request] get error while invoke unittest.main() --- cannot be used in Sikuli scripts

Bug #1331976 reported by RaiMan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Won't Fix
Medium
RaiMan

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)

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.2.0
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Won't Fix
milestone: 2.0.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.