Revision: 135
Author: psoberoi
Date: Thu May 6 20:26:09 2010
Log: added multiprocessing tests to reproduce issue 20
http://code.google.com/p/iniparse/source/detail?r=135
Added:
/trunk/tests/test_multiprocessing.py
Modified:
/trunk/tests/__init__.py
=======================================
--- /dev/null
+++ /trunk/tests/test_multiprocessing.py Thu May 6 20:26:09 2010
@@ -0,0 +1,41 @@
+import unittest
+try:
+ from multiprocessing import Process, Queue, Pipe
+ disabled = False
+except ImportError:
+ disabled = True
+
+from iniparse import compat, ini
+
+def get_x_dot_y(readfn, writefn):
+ cfg = readfn(timeout=3)
+ writefn(cfg.x.y)
+
+class test_ini(unittest.TestCase):
+ """Test sending INIConfig objects."""
+
+ def test_queue(self):
+ cfg = ini.INIConfig()
+ cfg.x.y = 42
+ q1 = Queue()
+ q2 = Queue()
+ p = Process(target=get_x_dot_y, args=(q1.get, q2.put))
+ q1.put(cfg)
+ self.assertEqual(q2.get(timeout=3), 42)
+
+ def test_pipe(self):
+ cfg = ini.INIConfig()
+ cfg.x.y = 42
+ c1, c2 = Pipe()
+ p = Process(target=get_x_dot_y, args=(c1.recv ,c2.send))
+ c1.send(cfg)
+ self.assertEqual(c2.recv(timeout=3), 42)
+
+class suite(unittest.TestSuite):
+ def __init__(self):
+ if disabled:
+ unittest.TestSuite.__init__(self, [])
+ else:
+ unittest.TestSuite.__init__(self, [
+ unittest.makeSuite(test_ini, 'test'),
+ ])
=======================================
--- /trunk/tests/__init__.py Fri Feb 26 09:12:27 2010
+++ /trunk/tests/__init__.py Thu May 6 20:26:09 2010
@@ -6,6 +6,7 @@
import test_compat
import test_unicode
import test_tidy
+import test_multiprocessing
from iniparse import config
from iniparse import ini
@@ -20,4 +21,5 @@
test_compat.suite(),
test_unicode.suite(),
test_tidy.suite(),
+ test_multiprocessing.suite(),
])
--
To post to this group, send email to
iniparse...@googlegroups.com
To unsubscribe from this group, send email to
iniparse-commi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/iniparse-commits?hl=en