<s> import os <EOL> from datetime import datetime <EOL> from uuid import uuid4 <EOL> from unittest2 import TestCase <EOL> from sh import git , rm , touch <EOL> class BaseTestCase ( TestCase ) : <EOL> maxDiff = None <EOL> tmp_git_repo = None <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> cls . tmp_git_repo = os . path . realpath ( "<STR_LIT>" % datetime . now ( ) . strftime ( "<STR_LIT>" ) ) <EOL> git ( "<STR_LIT>" , cls . tmp_git_repo ) <EOL> git ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , _cwd = cls . tmp_git_repo ) <EOL> git ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , _cwd = cls . tmp_git_repo ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> """<STR_LIT>""" <EOL> rm ( "<STR_LIT>" , cls . tmp_git_repo ) <EOL> def _create_simple_commit ( self , message , out = None , ok_code = None , env = None ) : <EOL> """<STR_LIT>""" <EOL> test_filename = "<STR_LIT>" + str ( uuid4 ( ) ) <EOL> touch ( test_filename , _cwd = self . tmp_git_repo ) <EOL> git ( "<STR_LIT>" , test_filename , _cwd = self . tmp_git_repo ) <EOL> git ( "<STR_LIT>" , "<STR_LIT>" , message , _cwd = self . tmp_git_repo , _tty_in = True , _out = out , _ok_code = ok_code , _env = env ) <EOL> return test_filename <EOL> @ staticmethod <EOL> def get_sample_path ( filename = "<STR_LIT>" ) : <EOL> samples_dir = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , "<STR_LIT>" ) <EOL> return os . path . join ( samples_dir , filename ) </s>
