<s> import os <EOL> import shutil <EOL> import sys <EOL> import tempfile <EOL> import unittest <EOL> pjoin = os . path . join <EOL> from . utils import assert_is_file , assert_is_dir , test_dir <EOL> running_python = '<STR_LIT:.>' . join ( str ( x ) for x in sys . version_info [ : <NUM_LIT:3> ] ) <EOL> sample_path = [ pjoin ( test_dir , '<STR_LIT>' ) , <EOL> pjoin ( test_dir , '<STR_LIT>' ) , <EOL> pjoin ( test_dir , '<STR_LIT>' ) , <EOL> ] <EOL> from nsist . copymodules import copy_modules , ExtensionModuleMismatch <EOL> class TestCopyModules ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . target = tempfile . mkdtemp ( ) <EOL> def tearDown ( self ) : <EOL> shutil . rmtree ( self . target ) <EOL> def test_copy_plain ( self ) : <EOL> copy_modules ( [ '<STR_LIT>' , '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) <EOL> assert_is_file ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> assert_is_dir ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> @ unittest . skipIf ( sys . platform . startswith ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> def test_copy_wrong_platform ( self ) : <EOL> with self . assertRaisesRegexp ( ExtensionModuleMismatch , "<STR_LIT>" ) : <EOL> copy_modules ( [ '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) <EOL> with self . assertRaisesRegexp ( ExtensionModuleMismatch , "<STR_LIT>" ) : <EOL> copy_modules ( [ '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) <EOL> @ unittest . skipUnless ( sys . platform . startswith ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> def test_copy_windows ( self ) : <EOL> copy_modules ( [ '<STR_LIT>' , '<STR_LIT>' ] , self . target , running_python , sample_path ) <EOL> assert_is_file ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> assert_is_dir ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> @ unittest . skipUnless ( sys . platform . startswith ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> def test_copy_wrong_pyversion ( self ) : <EOL> with self . assertRaisesRegexp ( ExtensionModuleMismatch , "<STR_LIT>" ) : <EOL> copy_modules ( [ '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) <EOL> with self . assertRaisesRegexp ( ExtensionModuleMismatch , "<STR_LIT>" ) : <EOL> copy_modules ( [ '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) <EOL> def test_copy_from_zipfile ( self ) : <EOL> copy_modules ( [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> self . target , running_python , sample_path ) <EOL> assert_is_file ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> assert_is_dir ( pjoin ( self . target , '<STR_LIT>' ) ) <EOL> def test_module_not_found ( self ) : <EOL> with self . assertRaises ( ImportError ) : <EOL> copy_modules ( [ '<STR_LIT>' ] , self . target , '<STR_LIT>' , sample_path ) </s>
