Skip to content

Commit

Permalink
TST: multiprocessing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
changhiskhan authored and wesm committed Dec 1, 2012
1 parent 19eeff8 commit 35b7f6e
Show file tree
Hide file tree
Showing 28 changed files with 648 additions and 310 deletions.
2 changes: 1 addition & 1 deletion pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def test_sparse_frame(self):

def test_sparse_panel(self):
items = ['x', 'y', 'z']
p = Panel(dict((i, tm.makeDataFrame()) for i in items))
p = Panel(dict((i, tm.makeDataFrame().ix[:2, :2]) for i in items))
sp = p.to_sparse()

self._check_double_roundtrip(sp, tm.assert_panel_equal,
Expand Down
6 changes: 3 additions & 3 deletions pandas/io/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from pandas import Series, Index, DataFrame

class TestSQLite(unittest.TestCase):

_multiprocess_can_split_ = True
def setUp(self):
self.db = sqlite3.connect(':memory:')

def test_basic(self):
frame = tm.makeTimeDataFrame()
self._check_roundtrip(frame)

def test_write_row_by_row(self):
frame = tm.makeTimeDataFrame()
frame.ix[0, 0] = np.nan
Expand Down Expand Up @@ -177,7 +177,7 @@ def test_keyword_as_column_names(self):
df = DataFrame({'From':np.ones(5)})
#print sql.get_sqlite_schema(df, 'testkeywords')
sql.write_frame(df, con = self.db, name = 'testkeywords')

if __name__ == '__main__':
# unittest.main()
import nose
Expand Down
2 changes: 2 additions & 0 deletions pandas/io/tests/test_yahoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import pandas.io.data as pd
import nose
from pandas.util.testing import network
from numpy.testing.decorators import slow
import urllib2

class TestYahoo(unittest.TestCase):

@slow
@network
def test_yahoo(self):
# asserts that yahoo is minimally working and that it throws
Expand Down
2 changes: 1 addition & 1 deletion pandas/sparse/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def assert_sp_array_equal(left, right):


class TestSparseArray(unittest.TestCase):

_multiprocess_can_split_ = True
def setUp(self):
self.arr_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6])
self.arr = SparseArray(self.arr_data)
Expand Down
2 changes: 2 additions & 0 deletions pandas/sparse/tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def assert_sp_list_equal(left, right):

class TestSparseList(unittest.TestCase):

_multiprocess_can_split_ = True

def setUp(self):
self.na_data = np.array([nan, nan, 1, 2, 3, nan, 4, 5, nan, 6])
self.zero_data = np.array([0, 0, 1, 2, 3, 0, 4, 5, 0, 6])
Expand Down
38 changes: 34 additions & 4 deletions pandas/sparse/tests/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def assert_sp_panel_equal(left, right, exact_indices=True):

class TestSparseSeries(TestCase,
test_series.CheckNameIntegration):

_multiprocess_can_split_ = True
def setUp(self):
arr, index = _test_data1()

Expand Down Expand Up @@ -686,7 +686,7 @@ class TestSparseTimeSeries(TestCase):

class TestSparseDataFrame(TestCase, test_frame.SafeForSparse):
klass = SparseDataFrame

_multiprocess_can_split_ = True
def setUp(self):
self.data = {'A' : [nan, nan, nan, 0, 1, 2, 3, 4, 5, 6],
'B' : [0, 1, 2, nan, nan, nan, 3, 4, 5, 6],
Expand Down Expand Up @@ -851,7 +851,37 @@ def test_sparse_series_ops(self):
tmp = sys.stderr
sys.stderr = buf
try:
self._check_all(self._check_frame_ops)
self._check_frame_ops(self.frame)
finally:
sys.stderr = tmp

def test_sparse_series_ops_i(self):
import sys
buf = StringIO()
tmp = sys.stderr
sys.stderr = buf
try:
self._check_frame_ops(self.iframe)
finally:
sys.stderr = tmp

def test_sparse_series_ops_z(self):
import sys
buf = StringIO()
tmp = sys.stderr
sys.stderr = buf
try:
self._check_frame_ops(self.zframe)
finally:
sys.stderr = tmp

def test_sparse_series_ops_fill(self):
import sys
buf = StringIO()
tmp = sys.stderr
sys.stderr = buf
try:
self._check_frame_ops(self.fill_frame)
finally:
sys.stderr = tmp

Expand Down Expand Up @@ -1406,7 +1436,7 @@ def panel_data3():
class TestSparsePanel(TestCase,
test_panel.SafeForLongAndSparse,
test_panel.SafeForSparse):

_multiprocess_can_split_ = True
@classmethod
def assert_panel_equal(cls, x, y):
assert_sp_panel_equal(x, y)
Expand Down
5 changes: 2 additions & 3 deletions pandas/tests/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class TestMatch(unittest.TestCase):

_multiprocess_can_split_ = True
def test_ints(self):
values = np.array([0, 2, 1])
to_match = np.array([0, 1, 2, 2, 0, 1, 3, 0])
Expand All @@ -29,7 +29,7 @@ def test_strings(self):


class TestUnique(unittest.TestCase):

_multiprocess_can_split_ = True
def test_ints(self):
arr = np.random.randint(0, 100, size=50)

Expand Down Expand Up @@ -70,4 +70,3 @@ def test_quantile():
import nose
nose.runmodule(argv=[__file__,'-vvs','-x','--pdb', '--pdb-failure'],
exit=False)

4 changes: 4 additions & 0 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from pandas.tslib import iNaT
from pandas.util import py3compat

_multiprocess_can_split_ = True

def test_is_sequence():
is_seq=com._is_sequence
assert(is_seq((1,2)))
Expand Down Expand Up @@ -246,6 +248,8 @@ def test_pprint_thing():

class TestTake(unittest.TestCase):

_multiprocess_can_split_ = True

def test_1d_with_out(self):
def _test_dtype(dtype):
out = np.empty(5, dtype=dtype)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import nose

class TestConfig(unittest.TestCase):

_multiprocess_can_split_ = True
def __init__(self,*args):
super(TestConfig,self).__init__(*args)

Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/test_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class TestCategorical(unittest.TestCase):

_multiprocess_can_split_ = True
def setUp(self):
self.factor = Categorical.from_array(['a', 'b', 'b', 'a',
'a', 'c', 'c', 'c'])
Expand Down Expand Up @@ -115,5 +115,3 @@ def test_na_flags_int_levels(self):
nose.runmodule(argv=[__file__,'-vvs','-x','--pdb', '--pdb-failure'],
# '--with-coverage', '--cover-package=pandas.core'],
exit=False)


6 changes: 3 additions & 3 deletions pandas/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def curpath():
return pth

class TestDataFrameFormatting(unittest.TestCase):

_multiprocess_can_split_ = True
def setUp(self):
self.frame = _frame.copy()

Expand Down Expand Up @@ -843,7 +843,7 @@ def test_to_latex(self):
self.frame.to_latex()

class TestSeriesFormatting(unittest.TestCase):

_multiprocess_can_split_ = True
def setUp(self):
self.ts = tm.makeTimeSeries()

Expand Down Expand Up @@ -958,7 +958,7 @@ def test_mixed_datetime64(self):
self.assertTrue('2012-01-01' in result)

class TestEngFormatter(unittest.TestCase):

_multiprocess_can_split_ = True
def test_eng_float_formatter(self):
df = DataFrame({'A' : [1.41, 141., 14100, 1410000.]})

Expand Down
Loading

0 comments on commit 35b7f6e

Please sign in to comment.