Beispiel #1
0
 def test_get_data_with_list(self):
     try:
         data = self.aapl.get_call_data(expiry=self.aapl.expiry_dates)
     except RemoteDataError as e:
         raise nose.SkipTest(e)
     self.assertTrue(len(data) > 1)
Beispiel #2
0
 def skip(self, msg='skipped '):
     raise nose.SkipTest(msg)
Beispiel #3
0
 def test_compression_zlib(self):
     if not _ZLIB_INSTALLED:
         raise nose.SkipTest('no zlib')
     self._test_compression('zlib')
Beispiel #4
0
 def test_compression_warns_when_decompress_caches_zlib(self):
     if not _ZLIB_INSTALLED:
         raise nose.SkipTest('no zlib')
     self._test_compression_warns_when_decompress_caches('zlib')
Beispiel #5
0
 def test_small_strings_no_warn_zlib(self):
     if not _ZLIB_INSTALLED:
         raise nose.SkipTest('no zlib')
     self._test_small_strings_no_warn('zlib')
Beispiel #6
0
def _skip_if_no_xlsxwriter():
    try:
        import xlsxwriter  # NOQA
    except ImportError:
        raise nose.SkipTest('xlsxwriter not installed, skipping')
Beispiel #7
0
import sys

from datetime import datetime
import numpy as np

from pandas import (Series, DataFrame, Panel, MultiIndex, bdate_range,
                    date_range, Index)
from pandas.io.pytables import HDFStore, get_store
import pandas.util.testing as tm
from pandas.tests.test_series import assert_series_equal
from pandas.tests.test_frame import assert_frame_equal

try:
    import tables
except ImportError:
    raise nose.SkipTest('no pytables')

from distutils.version import LooseVersion

_default_compressor = LooseVersion(tables.__version__) >= '2.2' \
                      and 'blosc' or 'zlib'

class TestHDFStore(unittest.TestCase):
    path = '__test__.h5'
    scratchpath = '__scratch__.h5'

    def setUp(self):
        self.store = HDFStore(self.path)

    def tearDown(self):
        self.store.close()
Beispiel #8
0
def _skip_if_no_pchip():
    try:
        from scipy.interpolate import pchip_interpolate  # noqa
    except ImportError:
        import nose
        raise nose.SkipTest('scipy.interpolate.pchip missing')
Beispiel #9
0
 def skipper_func(*args, **kwargs):
     """Skipper for normal test functions."""
     if skip_val():
         raise nose.SkipTest(get_msg(f, msg))
     else:
         return f(*args, **kwargs)
Beispiel #10
0
def _skip_if_no_xlrd():
    try:
        import xlrd
    except ImportError:
        raise nose.SkipTest('xlrd not installed, skipping')
Beispiel #11
0
 def wrapper():
     try:
         importlib.import_module(self.module)
     except ImportError:
         raise nose.SkipTest("requires {}".format(self.module))
     return func()
Beispiel #12
0
    def setup_class(cls):
        wsgiapp = middleware.make_app(config['global_conf'], **config)
        cls.app = paste.fixture.TestApp(wsgiapp)
        if not tests.is_datastore_supported():
            raise nose.SkipTest("Datastore not supported")
        p.load('datastore')
        ctd.CreateTestData.create()
        cls.sysadmin_user = model.User.get('testsysadmin')
        cls.normal_user = model.User.get('annafan')
        resource = model.Package.get('annakarenina').resources[0]
        cls.data = {
            'resource_id': resource.id,
            'force': True,
            'aliases': 'books',
            'fields': [
                {
                    'id': u'b\xfck',
                    'type': 'text'
                },
                {
                    'id': 'author',
                    'type': 'text'
                },
                {
                    'id': 'published'
                },
                {
                    'id': u'characters',
                    u'type': u'_text'
                },
                {
                    'id': 'random_letters',
                    'type': 'text[]'
                }
            ],
            'records': [
                {
                    u'b\xfck': 'annakarenina',
                    'author': 'tolstoy',
                    'published': '2005-03-01',
                    'nested': [
                        'b',
                        {'moo': 'moo'}
                    ],
                    u'characters': [
                        u'Princess Anna',
                        u'Sergius'
                    ],
                    'random_letters': [
                        'a', 'e', 'x'
                    ]
                },
                {
                    u'b\xfck': 'warandpeace',
                    'author': 'tolstoy',
                    'nested': {'a': 'b'},
                    'random_letters': [

                    ]
                }
            ]
        }
        postparams = '%s=1' % json.dumps(cls.data)
        auth = {'Authorization': str(cls.sysadmin_user.apikey)}
        res = cls.app.post('/api/action/datastore_create', params=postparams,
                           extra_environ=auth)
        res_dict = json.loads(res.body)
        assert res_dict['success'] is True

        engine = db.get_write_engine()
        cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine))
Beispiel #13
0
 def setUpClass(cls):
     super(TestGoogle, cls).setUpClass()
     cls.locales = tm.get_locales(prefix='en_US')
     if not cls.locales:
         raise nose.SkipTest("US English locale not available for testing")
Beispiel #14
0
 def test_get_all_data_calls_only(self):
     try:
         data = self.aapl.get_all_data(call=True, put=False)
     except RemoteDataError as e:
         raise nose.SkipTest(e)
     self.assertTrue(len(data) > 1)
Beispiel #15
0
def _skip_if_no_xlwt():
    try:
        import xlwt  # NOQA
    except ImportError:
        raise nose.SkipTest('xlwt not installed, skipping')
Beispiel #16
0
def _skip_if_no_pytz():
    try:
        import pytz
    except ImportError:
        raise nose.SkipTest("pytz not installed")
Beispiel #17
0
def _skip_if_no_openpyxl():
    try:
        import openpyxl  # NOQA
    except ImportError:
        raise nose.SkipTest('openpyxl not installed, skipping')
Beispiel #18
0
def _skip_if_no(module_name):
    if not _have_module(module_name):
        raise nose.SkipTest("{0!r} not found".format(module_name))
Beispiel #19
0
def _validation_fail_helper(validator, arg, exception_type):
    if sys.version_info[:2] < (2, 7):
        raise nose.SkipTest("assert_raises as context manager not "
                            "supported with Python < 2.7")
    with assert_raises(exception_type):
        validator(arg)
Beispiel #20
0
def _skip_if_no_bioformats():
    if not pims.bioformats.available():
        raise nose.SkipTest('JPype is not installed. Skipping.')
Beispiel #21
0
def _skip_if_no_scipy_gaussian_kde():
    try:
        from scipy.stats import gaussian_kde  # noqa
    except ImportError:
        raise nose.SkipTest("scipy version doesn't support gaussian_kde")
Beispiel #22
0
 def check_skip(self):
     _skip_if_no_bioformats()
     if not os.path.isfile(self.filename):
         raise nose.SkipTest('File missing. Skipping.')
Beispiel #23
0
 def test_compression_warns_when_decompress_caches_blosc(self):
     if not _BLOSC_INSTALLED:
         raise nose.SkipTest('no blosc')
     self._test_compression_warns_when_decompress_caches('blosc')
def _get_cffi_data():
    if not HAVE_CFFI:
        raise nose.SkipTest("cffi not installed")
    ffi = cffi.FFI()
    return ffi.new('double *', 2.0)
Beispiel #25
0
 def test_small_strings_no_warn_blosc(self):
     if not _BLOSC_INSTALLED:
         raise nose.SkipTest('no blosc')
     self._test_small_strings_no_warn('blosc')
Beispiel #26
0
# -- If we can't create a TempMongo instance, then
#    simply print what happened,
try:
    with TempMongo() as temp_mongo:
        pass
except OSError as e:
    print(e, file=sys.stderr)
    print(
        ("Failed to create a TempMongo context,"
         " skipping all mongo tests."),
        file=sys.stderr,
    )
    if "such file" in str(e):
        print("Hint: is mongod executable on path?", file=sys.stderr)
    raise nose.SkipTest()


class TestMongoTrials(hyperopt.tests.test_base.TestTrials):
    def setUp(self):
        self.temp_mongo = TempMongo()
        self.temp_mongo.__enter__()
        self.trials = MongoTrials(self.temp_mongo.connection_string("foo"),
                                  exp_key=None)

    def tearDown(self, *args):
        self.temp_mongo.__exit__(*args)


def with_mongo_trials(f, exp_key=None):
    def wrapper():
Beispiel #27
0
# flake8: noqa

from __future__ import print_function

import pandas.util.testing as tm

from pandas.compat import range
import nose

raise nose.SkipTest('skipping this for now')

try:
    import statsmodels.tsa.var as sm_var
    import statsmodels as sm
except ImportError:
    import scikits.statsmodels.tsa.var as sm_var
    import scikits.statsmodels as sm


import pandas.stats.var as _pvar
reload(_pvar)
from pandas.stats.var import VAR

DECIMAL_6 = 6
DECIMAL_5 = 5
DECIMAL_4 = 4
DECIMAL_3 = 3
DECIMAL_2 = 2


class CheckVAR(object):
 def setUp(self):
     if not pdml.compat._SKLEARN_ge_017:
         import nose
         raise nose.SkipTest()
Beispiel #29
0
 def test_compression_blosc(self):
     if not _BLOSC_INSTALLED:
         raise nose.SkipTest('no blosc')
     self._test_compression('blosc')
Beispiel #30
0
 def test_get_all_data(self):
     try:
         data = self.aapl.get_all_data(put=True)
     except RemoteDataError as e:
         raise nose.SkipTest(e)
     self.assertTrue(len(data) > 1)