Fixing more tests using multiprocessing on Windows

This commit is contained in:
Ben Vanik 2012-05-17 20:10:46 -07:00
parent 04be5f1180
commit 05038116f0
3 changed files with 15 additions and 8 deletions

View File

@ -358,6 +358,8 @@ class MultiProcessTaskExecutor(TaskExecutor):
"""
super(MultiProcessTaskExecutor, self).__init__(*args, **kwargs)
self.worker_count = worker_count
self._waiting_deferreds = {}
try:
self._pool = multiprocessing.Pool(processes=self.worker_count,
initializer=_task_initializer)
@ -369,7 +371,6 @@ class MultiProcessTaskExecutor(TaskExecutor):
'workaround. Boo!')
print 'Try running with -j1 to disable multiprocessing'
raise
self._waiting_deferreds = {}
def run_task_async(self, task):
if self.closed:

View File

@ -144,7 +144,7 @@ class WhichTest(unittest2.TestCase):
self.assertIsNotNone(util.which('notepad.exe'))
@unittest2.skipIf(sys.platform.startswith('win'), 'platform')
def testLinux(self):
def testUnix(self):
self.assertEqual(util.which('/bin/sh'), '/bin/sh')
self.assertIsNone(util.which('xxx'))
self.assertIsNotNone(util.which('cat'))

View File

@ -13,9 +13,15 @@ __author__ = 'benvanik@google.com (Ben Vanik)'
import os
import sys
def main():
# Add self to the root search path
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# Run the tests
import anvil.test
anvil.test.main()
if __name__ == '__main__':
main()