<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> import os <EOL> import unittest <EOL> from pants . base . build_environment import get_pants_cachedir , get_pants_configdir <EOL> from pants . util . contextutil import environment_as <EOL> from pants . util . fileutil import temporary_file <EOL> class TestBuildEnvironment ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_get_configdir ( self ) : <EOL> with environment_as ( XDG_CONFIG_HOME = '<STR_LIT>' ) : <EOL> self . assertEquals ( os . path . expanduser ( '<STR_LIT>' ) , get_pants_configdir ( ) ) <EOL> def test_get_cachedir ( self ) : <EOL> with environment_as ( XDG_CACHE_HOME = '<STR_LIT>' ) : <EOL> self . assertEquals ( os . path . expanduser ( '<STR_LIT>' ) , get_pants_cachedir ( ) ) <EOL> def test_set_configdir ( self ) : <EOL> with temporary_file ( ) as temp : <EOL> with environment_as ( XDG_CONFIG_HOME = temp . name ) : <EOL> self . assertEquals ( os . path . join ( temp . name , '<STR_LIT>' ) , get_pants_configdir ( ) ) <EOL> def test_set_cachedir ( self ) : <EOL> with temporary_file ( ) as temp : <EOL> with environment_as ( XDG_CACHE_HOME = temp . name ) : <EOL> self . assertEquals ( os . path . join ( temp . name , '<STR_LIT>' ) , get_pants_cachedir ( ) ) <EOL> def test_expand_home_configdir ( self ) : <EOL> with environment_as ( XDG_CONFIG_HOME = '<STR_LIT>' ) : <EOL> self . assertEquals ( os . path . expanduser ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) , <EOL> get_pants_configdir ( ) ) </s>
