<s> """<STR_LIT>""" <EOL> from __future__ import ( absolute_import , division , print_function ) <EOL> import os <EOL> from os . path import join as pjoin , dirname , split as psplit <EOL> import sys <EOL> import shutil <EOL> from tempfile import mkdtemp <EOL> from subprocess import call <EOL> from nose . tools import assert_true , assert_false , assert_equal , assert_raises <EOL> _downpath , _ = psplit ( dirname ( __file__ ) ) <EOL> ROOT_DIR = os . path . abspath ( _downpath ) <EOL> sys . path . append ( ROOT_DIR ) <EOL> import gitwash_dumper as gwd <EOL> EXE_PTH = pjoin ( ROOT_DIR , '<STR_LIT>' ) <EOL> DOC_DIR = pjoin ( _downpath , '<STR_LIT>' ) <EOL> TMPDIR = None <EOL> def setup ( ) : <EOL> global TMPDIR <EOL> TMPDIR = mkdtemp ( ) <EOL> def teardown ( ) : <EOL> shutil . rmtree ( TMPDIR ) <EOL> def test_link_checks ( ) : <EOL> test_fname = pjoin ( TMPDIR , '<STR_LIT>' ) <EOL> gwd . make_link_targets ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> pjoin ( DOC_DIR , '<STR_LIT>' ) , <EOL> test_fname , <EOL> None , <EOL> None ) <EOL> assert_false ( os . path . isfile ( test_fname ) ) <EOL> gwd . make_link_targets ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> pjoin ( DOC_DIR , '<STR_LIT>' ) , <EOL> test_fname , <EOL> '<STR_LIT>' , <EOL> None ) <EOL> with open ( test_fname , '<STR_LIT>' ) as test_fh : <EOL> expected_text = test_fname . read ( ) <EOL> assert_equal ( expected_text , <EOL> """<STR_LIT>""" ) <EOL> def test_dumper ( ) : <EOL> call ( [ EXE_PTH , <EOL> TMPDIR , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % ROOT_DIR ] ) <EOL> gitwdir = pjoin ( TMPDIR , '<STR_LIT>' ) <EOL> assert_true ( os . path . isdir ( gitwdir ) ) <EOL> for dirpath , dirnames , filenames in os . walk ( gitwdir ) : <EOL> if not dirpath . endswith ( '<STR_LIT>' ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> for filename in filenames : <EOL> old_fname = pjoin ( DOC_DIR , filename ) <EOL> new_fname = pjoin ( dirpath , filename ) <EOL> old_contents = file ( old_fname , '<STR_LIT>' ) . readlines ( ) <EOL> new_contents = file ( new_fname , '<STR_LIT>' ) . readlines ( ) <EOL> for old , new in zip ( old_contents , new_contents ) : <EOL> if '<STR_LIT>' in old and not filename . endswith ( '<STR_LIT>' ) : <EOL> assert_false ( '<STR_LIT>' in new ) <EOL> assert_true ( '<STR_LIT>' in new ) <EOL> shutil . rmtree ( gitwdir ) <EOL> def test_building ( ) : <EOL> call ( [ EXE_PTH , <EOL> TMPDIR , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % ROOT_DIR ] ) <EOL> cwd = os . getcwd ( ) <EOL> shutil . copy ( pjoin ( ROOT_DIR , '<STR_LIT>' ) , TMPDIR ) <EOL> try : <EOL> os . chdir ( TMPDIR ) <EOL> with open ( '<STR_LIT>' , '<STR_LIT>' ) as index_fh : <EOL> index_fh . write ( '<STR_LIT:\n>' ) <EOL> call ( '<STR_LIT>' , <EOL> shell = True ) <EOL> call ( '<STR_LIT>' , <EOL> shell = True ) <EOL> finally : <EOL> os . chdir ( cwd ) </s>
