<s> """<STR_LIT>""" <EOL> import sys <EOL> if sys . hexversion < <NUM_LIT> : <EOL> import unittest2 as unittest <EOL> else : <EOL> import unittest <EOL> TestCase = unittest . TestCase <EOL> import os <EOL> from os . path import abspath , dirname <EOL> import functools <EOL> test_dir = dirname ( abspath ( __file__ ) ) <EOL> root_dir = dirname ( test_dir ) <EOL> sample_int = <NUM_LIT:1> <EOL> def cwd_at ( path ) : <EOL> """<STR_LIT>""" <EOL> def decorator ( func ) : <EOL> @ functools . wraps ( func ) <EOL> def wrapper ( * args , ** kwds ) : <EOL> try : <EOL> oldcwd = os . getcwd ( ) <EOL> repo_root = os . path . dirname ( test_dir ) <EOL> os . chdir ( os . path . join ( repo_root , path ) ) <EOL> return func ( * args , ** kwds ) <EOL> finally : <EOL> os . chdir ( oldcwd ) <EOL> return wrapper <EOL> return decorator </s>
