def __cleanup_build_and_watchdog(extra_contents_path, watchdog_file_path):
     for listed in listdir(extra_contents_path, recursive=False):
         try:
             shutil.copy(join(extra_contents_path, listed), extra_contents_path.replace('__building', ''))
         except Exception:
             pass
     shutil.rmtree(extra_contents_path)
     os.remove(watchdog_file_path)
 def __cleanup_build_and_watchdog(extra_contents_path, watchdog_file_path):
     for listed in listdir(extra_contents_path, recursive=False):
         try:
             shutil.copy(join(extra_contents_path, listed), extra_contents_path.replace("__building", ""))
         except Exception:
             pass
     shutil.rmtree(extra_contents_path)
     os.remove(watchdog_file_path)
示例#3
0
    def test_run_examples(self):
        folder = join('..', '..', '..', 'catalyst', 'examples')
        files = [f for f in listdir(folder) if isfile(join(folder, f))]

        algo_list = []
        for filename in files:
            name = os.path.basename(filename)
            if filter_algos and name not in filter_algos:
                continue

            module_name = 'catalyst.examples.{}'.format(name.replace(
                '.py', ''))
            algo_list.append(module_name)

        for module_name in algo_list:
            algo = importlib.import_module(module_name)
            namespace = module_name.replace('.', '_')

            log_catcher = TestHandler()
            with log_catcher:
                run_algorithm(
                    capital_base=0.1,
                    data_frequency='minute',
                    initialize=algo.initialize,
                    handle_data=algo.handle_data,
                    analyze=TestSuiteAlgo.analyze,
                    exchange_name='poloniex',
                    algo_namespace='test_{}'.format(namespace),
                    base_currency='eth',
                    start=pd.to_datetime('2017-10-01', utc=True),
                    end=pd.to_datetime('2017-10-02', utc=True),
                    # output=out
                )
                warnings = [
                    record for record in log_catcher.records
                    if record.level == WARNING
                ]

                if len(warnings) > 0:
                    print('WARNINGS:\n{}'.format(warnings))
            pass
示例#4
0
    def test_run_examples(self):
        folder = join('..', '..', '..', 'catalyst', 'examples')
        files = [f for f in listdir(folder) if isfile(join(folder, f))]

        algo_list = []
        for filename in files:
            name = os.path.basename(filename)
            if filter_algos and name not in filter_algos:
                continue

            module_name = 'catalyst.examples.{}'.format(
                name.replace('.py', '')
            )
            algo_list.append(module_name)

        for module_name in algo_list:
            algo = importlib.import_module(module_name)
            namespace = module_name.replace('.', '_')

            log_catcher = TestHandler()
            with log_catcher:
                run_algorithm(
                    capital_base=0.1,
                    data_frequency='minute',
                    initialize=algo.initialize,
                    handle_data=algo.handle_data,
                    analyze=TestSuiteAlgo.analyze,
                    exchange_name='poloniex',
                    algo_namespace='test_{}'.format(namespace),
                    base_currency='eth',
                    start=pd.to_datetime('2017-10-01', utc=True),
                    end=pd.to_datetime('2017-10-02', utc=True),
                    # output=out
                )
                warnings = [record for record in log_catcher.records if
                            record.level == WARNING]

                if len(warnings) > 0:
                    print('WARNINGS:\n{}'.format(warnings))
            pass