def test_symlinking_libraries(): env = Environment(falconf_string=""" test: libraries: - cpp """) flyer = Flyer(mode='test', env=env) flyer.symlink_libraries() assert does_file_exist('cpp/include/Grader.h') remove_symlink('cpp')
def main(args={}): """ The main event. Args: args (dict) Returns: int: Exit code. string: If output == 'return' """ exit_code = 1 falconf = None local_falconf = None env = Environment() # this dictionary checking exists to rectify defaults with command line args and the config dict passed to udfalcon.fly() if not exists(dictionary=args, key='debug'): args['debug'] = False if not exists(dictionary=args, key='link'): args['link'] = False if not exists(dictionary=args, key='mode'): args['mode'] = 'submit' if not exists(dictionary=args, key='output'): args['output'] = 'json' # symlink and then shortcircuit if they used --link if exists(dictionary=args, key='link') and args['link']: flyer = Flyer() if flyer.symlink_libraries(args['link']): return 0 else: return 1 # find a falconf file if is_valid_falconf_specified(args): with open(args['config'], 'r') as f: falconf = f.read() # change the path if the falconf is elsewhere newpath = os.path.dirname(falconf) if newpath != '': os.chdir(newpath) elif file_exists('falconf.yaml') or file_exists('falconf.yml'): if args['debug']: print('Using local falconf file.') falconf = env.get_local_falconf() possible_results_output = None # run student code if falconf is not None: flyer = fly(args, falconf, env) possible_results_output = format_results(flyer, args['debug'], args['output']) exit_code = 0 elif args['debug']: eprint('No falconf found.') if possible_results_output is not None: return possible_results_output else: return exit_code