<s> """<STR_LIT>""" <EOL> import pytest <EOL> import os <EOL> import shutil <EOL> from util_functions import SCRIPT_LOC , REPLAY_DIR , script_cmd , load_json_file <EOL> from util_functions import run_ofSM <EOL> @ pytest . mark . usefixtures ( '<STR_LIT>' ) <EOL> class TestRecord : <EOL> """<STR_LIT>""" <EOL> def test_record ( self ) : <EOL> run_ofSM ( '<STR_LIT>' ) <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_remotedir ( self ) : <EOL> currentdir = os . getcwd ( ) <EOL> os . chdir ( os . path . dirname ( SCRIPT_LOC ) ) <EOL> ret = script_cmd ( <EOL> os . path . join ( '<STR_LIT>' , os . path . basename ( SCRIPT_LOC ) ) + '<STR_LIT>' + <EOL> os . path . join ( currentdir , '<STR_LIT>' ) , <EOL> os . getcwd ( ) ) <EOL> assert ret == <NUM_LIT:0> <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( currentdir , '<STR_LIT>' , <EOL> '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_default_p_dir ( self ) : <EOL> currentdir = os . getcwd ( ) <EOL> os . chdir ( '<STR_LIT>' ) <EOL> run_ofSM ( '<STR_LIT>' ) <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( currentdir , '<STR_LIT>' , <EOL> '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_named ( self , capfd ) : <EOL> out , err = run_ofSM ( '<STR_LIT>' , capfd = capfd ) <EOL> assert '<STR_LIT>' not in out <EOL> assert '<STR_LIT>' not in err <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , <EOL> '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_verbosity ( self , capfd ) : <EOL> out , _ = run_ofSM ( '<STR_LIT>' , <EOL> capfd = capfd ) <EOL> assert '<STR_LIT>' in out <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , <EOL> '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_wrong_project ( self , capfd ) : <EOL> _ , err = run_ofSM ( '<STR_LIT>' , capfd = capfd , <EOL> desired_exit_status = <NUM_LIT:1> ) <EOL> assert '<STR_LIT>' in err <EOL> def test_record_update ( self ) : <EOL> shutil . copyfile ( os . path . join ( REPLAY_DIR , '<STR_LIT>' ) , <EOL> os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> run_ofSM ( '<STR_LIT>' , desired_exit_status = <NUM_LIT:1> ) <EOL> run_ofSM ( '<STR_LIT>' ) <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , <EOL> '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_description ( self ) : <EOL> run_ofSM ( '<STR_LIT>' ) <EOL> std = load_json_file ( os . path . join ( REPLAY_DIR , <EOL> '<STR_LIT>' ) ) <EOL> test = load_json_file ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> assert test == std <EOL> def test_record_empty_addons_make ( self , capfd ) : <EOL> fobj = open ( os . path . join ( os . getcwd ( ) , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:w>' ) <EOL> fobj . close ( ) <EOL> out , _ = run_ofSM ( '<STR_LIT>' , capfd = capfd ) <EOL> assert '<STR_LIT>' in out <EOL> def test_record_no_OF_location ( self , capfd ) : <EOL> fobj = open ( os . path . join ( os . getcwd ( ) , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:w>' ) <EOL> fobj . close ( ) <EOL> _ , err = run_ofSM ( '<STR_LIT>' , capfd = capfd , <EOL> desired_exit_status = <NUM_LIT:1> ) <EOL> assert '<STR_LIT>' in err <EOL> def test_record_addon_nonexistent ( self , capfd ) : <EOL> shutil . rmtree ( os . path . join ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> _ , err = run_ofSM ( '<STR_LIT>' , capfd = capfd , <EOL> desired_exit_status = <NUM_LIT:1> ) <EOL> assert '<STR_LIT>' in err <EOL> assert err . endswith ( '<STR_LIT>' ) <EOL> def test_record_addon_invalid ( self , capfd ) : <EOL> open ( os . path . join ( os . getcwd ( ) , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) , '<STR_LIT:w>' ) . close ( ) <EOL> _ , err = run_ofSM ( '<STR_LIT>' , capfd = capfd , <EOL> desired_exit_status = <NUM_LIT:1> ) <EOL> assert '<STR_LIT>' in err <EOL> def test_record_no_addonsmake ( self , capfd ) : <EOL> os . remove ( os . path . join ( os . getcwd ( ) , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> out , _ = run_ofSM ( '<STR_LIT>' , capfd = capfd ) <EOL> assert '<STR_LIT>' in out </s>
