shanmugh commented on a change in pull request #41: Memoize loader.load and loader.load_json URL: https://github.com/apache/aurora/pull/41#discussion_r221777660
########## File path: src/test/python/apache/aurora/config/test_loader.py ########## @@ -93,6 +101,27 @@ def test_load_json_single(): assert new_job == job +def test_load_json_memoized(): + env = AuroraConfigLoader.load(BytesIO(MESOS_CONFIG_MULTI)) + jobs = env['jobs'] + + with temporary_dir() as d: + with open(os.path.join(d, 'config.json'), 'w+') as fp: + fp.write(json.dumps(jobs[0].get())) + fp.close() + new_job = AuroraConfigLoader.load_json(fp.name, is_memoized=True)['jobs'][0] + assert new_job == jobs[0] + + with open(os.path.join(d, 'config.json'), 'w+') as fp: + fp.write(json.dumps(jobs[1].get())) + fp.close() + after_overwrite = AuroraConfigLoader.load_json(fp.name, is_memoized=True)['jobs'][0] + assert after_overwrite == jobs[0] + after_overwrite_no_memozied = AuroraConfigLoader.load_json( + fp.name, is_memoized=False)['jobs'][0] Review comment: nit - 1 arg per line ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services