

def __create_test_instance(self, config_monitors, platform_monitors):
    config_dir = tempfile.mkdtemp()
    config_file = os.path.join(config_dir, 'agentConfig.json')
    config_fragments_dir = os.path.join(config_dir, 'configs.d')
    os.makedirs(config_fragments_dir)
    monitors_json_array = JsonArray()
    for entry in config_monitors:
        monitors_json_array.add(JsonObject(content=entry))
    fp = open(config_file, 'w')
    fp.write(json_lib.serialize(JsonObject(api_key='fake', monitors=monitors_json_array)))
    fp.close()
    default_paths = DefaultPaths('/var/log/scalyr-agent-2', '/etc/scalyr-agent-2/agent.json', '/var/lib/scalyr-agent-2')
    config = Configuration(config_file, default_paths)
    config.parse()
    return MonitorsManager(config, FakePlatform(platform_monitors))

dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/tests/monitors_manager_test.py MonitorsManagerTest.__create_test_instance/original