def test_env_export(self): """ Test conda env export """ run_conda_command(Commands.CREATE, test_env_name_2, "flask") assert env_is_created(test_env_name_2) snowflake, e, = run_env_command(Commands.ENV_EXPORT, test_env_name_2) with Utf8NamedTemporaryFile(mode="w", suffix=".yml", delete=False) as env_yaml: env_yaml.write(snowflake) env_yaml.flush() env_yaml.close() run_env_command(Commands.ENV_REMOVE, test_env_name_2) self.assertFalse(env_is_created(test_env_name_2)) run_env_command(Commands.ENV_CREATE, None, "--file", env_yaml.name) self.assertTrue(env_is_created(test_env_name_2)) # regression test for #6220 snowflake, e, = run_env_command(Commands.ENV_EXPORT, test_env_name_2, '--no-builds') assert not e.strip() env_description = yaml_load(snowflake) assert len(env_description['dependencies']) for spec_str in env_description['dependencies']: assert spec_str.count('=') == 1 run_env_command(Commands.ENV_REMOVE, test_env_name_2) assert not env_is_created(test_env_name_2)
def test_env_export(self): """ Test conda env export """ run_conda_command(Commands.CREATE, test_env_name_2, "flask") assert env_is_created(test_env_name_2) snowflake, e, = run_env_command(Commands.ENV_EXPORT, test_env_name_2) with tempfile.NamedTemporaryFile(mode="w", suffix=".yml", delete=False) as env_yaml: env_yaml.write(snowflake) env_yaml.flush() env_yaml.close() run_env_command(Commands.ENV_REMOVE, test_env_name_2) self.assertFalse(env_is_created(test_env_name_2)) run_env_command(Commands.ENV_CREATE, env_yaml.name) self.assertTrue(env_is_created(test_env_name_2)) # regression test for #6220 snowflake, e, = run_env_command(Commands.ENV_EXPORT, test_env_name_2, '--no-builds') assert not e.strip() env_description = yaml_load(snowflake) assert len(env_description['dependencies']) for spec_str in env_description['dependencies']: assert spec_str.count('=') == 1 run_env_command(Commands.ENV_REMOVE, test_env_name_2) assert not env_is_created(test_env_name_2)