<s> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> import json <EOL> import unittest <EOL> from what import What <EOL> from kuyruk import Kuyruk <EOL> class LoaderTestCase ( unittest . TestCase ) : <EOL> def test_function_name ( self ) : <EOL> cases = [ <EOL> ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) , <EOL> ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) , <EOL> ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) , <EOL> ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) , <EOL> ] <EOL> with Kuyruk ( ) . channel ( ) as ch : <EOL> for args , cwd , name in cases : <EOL> print ( cwd , args , name ) <EOL> ch . queue_delete ( "<STR_LIT>" ) <EOL> run_python ( args , cwd = cwd ) <EOL> got = get_name ( ) <EOL> assert got == name , got <EOL> def run_python ( args , cwd ) : <EOL> dirname = os . path . dirname ( __file__ ) <EOL> cwd = os . path . join ( dirname , cwd ) <EOL> What ( sys . executable , * args . split ( '<STR_LIT:U+0020>' ) , cwd = cwd ) . expect_exit ( <NUM_LIT:0> ) <EOL> def get_name ( ) : <EOL> with Kuyruk ( ) . channel ( ) as ch : <EOL> message = ch . basic_get ( "<STR_LIT>" ) <EOL> desc = json . loads ( message . body ) <EOL> return '<STR_LIT:.>' . join ( [ desc [ '<STR_LIT>' ] , desc [ '<STR_LIT>' ] ] ) </s>
