Skip to content

Commit

Permalink
Add a unit test for a multiprocessing bug
Browse files Browse the repository at this point in the history
Add a test for DM-13316: AST errors when using multiprocessing
to return astshim objects
  • Loading branch information
r-owen committed Jan 30, 2018
1 parent c9ecffe commit 22bb869
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_object.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import, division, print_function
import multiprocessing
import unittest

import numpy as np
Expand Down Expand Up @@ -152,6 +153,19 @@ def test_ident(self):
cp = obj.copy()
self.assertEqual(cp.ident, "initial_ident")

def test_multiprocessing(self):
"""Make sure we can return objects from multiprocessing
This tests DM-13316: AST errors when using multiprocessing
to return astshim objects.
"""
numProcesses = 2
naxes = 1
params = [naxes]*numProcesses
pool = multiprocessing.Pool(processes=numProcesses)
results = pool.map(ast.UnitMap, params)
self.assertEqual(results, [ast.UnitMap(naxes)]*numProcesses)

def test_show(self):
# pick an object with no floats so we don't have to worry
# about the float representation
Expand Down

0 comments on commit 22bb869

Please sign in to comment.