denarced
unread,Aug 3, 2010, 6:16:30 AM8/3/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nose-users
I noticed that when using setUpClass, nose forgets about running
several processes.
Here's my piece of code:
----------------- code begin -----------------
#!/usr/bin/python
import unittest
import time
class my_tester(unittest.TestCase):
@classmethod
def setUpClass(cls):
print "class setup"
def setUp(self):
print "setting it up"
def test_1(self):
for ind in range(1,5):
print "hau",1
time.sleep(1)
def test_2(self):
for ind in range(1,5):
print "hau",2
time.sleep(1)
def test_3(self):
for ind in range(1,5):
print "hau",3
time.sleep(1)
def test_4(self):
for ind in range(1,5):
print "hau",4
time.sleep(1)
def test_5(self):
for ind in range(1,5):
print "hau",5
time.sleep(1)
----------------- code end -----------------
I ran this with the following command:
nosetests --processes=2 -s
The -s option is just so it doesn't suppress the prints in the tests.
Here's the output:
----------------- output begin -----------------
class setup
setting it up
hau 1
hau 1
hau 1
hau 1
setting it up
hau 2
hau 2
hau 2
hau 2
setting it up
hau 3
hau 3
hau 3
hau 3
setting it up
hau 4
hau 4
hau 4
hau 4
setting it up
hau 5
hau 5
hau 5
hau 5
----------------- output end -----------------
You can clearly see that it's running just one process.
If I remove the setUpClass, it's acting like it should..
Anyone know why ?