Exemplo n.º 1
0
 def test_windows_1252(self):
     with self.assertLogs(logging.getLogger('databay'),
                          level='WARNING') as cm:
         config.initialise()
         self.assertTrue(
             'stdin or stdout encoder is set to \'windows-1252\'' in
             ';'.join(cm.output))
Exemplo n.º 2
0
 def test_windows_1252_ignored(self, warning):
     config.initialise()
     string_args = ';'.join(
         [str(call[0][0]) for call in warning.call_args_list])
     self.assertTrue(
         'stdin or stdout encoder is set to \'windows-1252\''
         not in string_args, 'Should not contain windows-1252 warning')
Exemplo n.º 3
0
 def test_not_windows_1252(self):
     databay_logger = logging.getLogger('databay')
     temp = databay_logger.warning
     databay_logger.warning = MagicMock()
     config.initialise()
     self.assertTrue('stdin or stdout encoder is set to \'windows-1252\''
                     not in databay_logger.warning.call_args_list)
     databay_logger.warning = temp
Exemplo n.º 4
0
 def test_windows_1252_ignored(self):
     temp = logging.Logger.warning
     warning = logging.Logger.warning = MagicMock()
     config.initialise()
     string_args = ';'.join(
         [str(call[0][0]) for call in warning.call_args_list])
     self.assertTrue(
         'stdin or stdout encoder is set to \'windows-1252\''
         not in string_args, 'Should not contain windows-1252 warning')
     logging.Logger.warning = temp
Exemplo n.º 5
0
    def test_asyncio_monkey_patch_other_error(self, version_info):
        version_info.__getitem__.side_effect = lambda x: [3, 6][x]

        async def coroutine():
            return 123

        config.initialise()

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=RuntimeWarning)
            self.assertRaises(RuntimeError, asyncio.run, coroutine())
Exemplo n.º 6
0
    def test_asyncio_monkey_patch(self, version_info):
        version_info.__getitem__.side_effect = lambda x: [3, 6][x]

        config.initialise()

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=RuntimeWarning)
            coro = test_coroutine()
            asyncio.run(coro)

            asyncio.get_event_loop.assert_called()
            test_loop.run_until_complete.assert_called_with(coro)
Exemplo n.º 7
0
import os
import sys

from databay import config

sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

config.initialise()

from databay.record import Record
from databay.outlet import Outlet
from databay.inlet import Inlet
from databay.link import Link
from databay.link import Update
from databay.base_planner import BasePlanner
# from databay import inlets
# from databay import outlets
# from databay import planners
# from databay import misc