def test_search_paths_noenv(tmpdir): cdirs = ['config_a', 'config_b'] sdirs = ['config_b', 'schema_c'] vc = os.environ.pop('ZIRKON_CONFIG_PATH', None) vs = os.environ.pop('ZIRKON_SCHEMA_PATH', None) try: lst = tuple(search_paths()) finally: if vc: os.environ['ZIRKON_CONFIG_PATH'] = vc if vs: os.environ['ZIRKON_SCHEMA_PATH'] = vs assert len(lst) == 1 assert lst[0] == (os.getcwd(), get_config_classes())
def test_search_paths(tmpdir): cdirs = ['config_a', 'config_b'] sdirs = ['config_b', 'schema_c'] os.environ['ZIRKON_CONFIG_PATH'] = ':'.join(cdirs) os.environ['ZIRKON_SCHEMA_PATH'] = ':'.join(sdirs) try: lst = tuple(search_paths()) finally: del os.environ['ZIRKON_CONFIG_PATH'] del os.environ['ZIRKON_SCHEMA_PATH'] assert len(lst) == 5 assert lst[0] == (os.getcwd(), get_config_classes()) assert lst[1] == ('config_a', (Config,)) assert lst[2] == ('config_b', (Config,)) assert lst[3] == ('config_b', (Schema,)) assert lst[4] == ('schema_c', (Schema,))