def inspect_returning_callables_and_execution(fun, ignored_functions=None): project = ProjectMock(ignored_functions or []) execution = Execution(project=project) try: inspect_code_in_context(fun, execution) # Don't allow any POEs exceptions to propagate to the testing code. # Catch both string and normal exceptions. except: print("Caught exception inside point of entry:", last_exception_as_string()) print(last_traceback()) return project.get_callables(), execution
def inspect_returning_callables_and_execution(fun, ignored_functions=None): project = ProjectMock(ignored_functions or []) execution = Execution(project=project) try: inspect_code_in_context(fun, execution) # Don't allow any POEs exceptions to propagate to the testing code. # Catch both string and normal exceptions. except: print "Caught exception inside point of entry:", last_exception_as_string() print last_traceback() return project.get_callables(), execution
def inspect_project_dynamically(project): if project.points_of_entry and hasattr(generator_has_ended, 'unreliable'): log.warning("Pure Python implementation of util.generator_has_ended is " "not reliable on Python 2.4 and lower. Please compile the " "_util module or use Python 2.5 or higher.") for poe in project.points_of_entry.values(): try: log.info("Inspecting point of entry %s." % poe.name) dynamic.inspect_point_of_entry(poe) except SyntaxError as err: log.warning("Point of entry contains a syntax error: %s" % err) except: log.warning("Point of entry exited with error: %s" % last_exception_as_string()) log.debug("Full traceback:\n" + last_traceback())
def inspect_project_dynamically(project): if project.points_of_entry and hasattr(generator_has_ended, 'unreliable'): log.warning( "Pure Python implementation of util.generator_has_ended is " "not reliable on Python 2.4 and lower. Please compile the " "_util module or use Python 2.5 or higher.") for poe in project.points_of_entry.values(): try: log.info("Inspecting point of entry %s." % poe.name) dynamic.inspect_point_of_entry(poe) except SyntaxError as err: log.warning("Point of entry contains a syntax error: %s" % err) except: log.warning("Point of entry exited with error: %s" % last_exception_as_string()) log.debug("Full traceback:\n" + last_traceback())
count = 0 for path in python_modules_below(project.get_points_of_entry_path()): poe = ensure_point_of_entry(project, path) if poe.is_out_of_sync(): count += 1 return count def inspect_project_statically(project): return add_and_update_modules(project) + \ add_and_update_points_of_entry(project) def inspect_project_dynamically(project): if project.points_of_entry and hasattr(generator_has_ended, 'unreliable'): log.warning( "Pure Python implementation of util.generator_has_ended is " "not reliable on Python 2.4 and lower. Please compile the " "_util module or use Python 2.5 or higher.") for poe in project.points_of_entry.values(): try: log.info("Inspecting point of entry %s." % poe.name) dynamic.inspect_point_of_entry(poe) except SyntaxError, err: log.warning("Point of entry contains a syntax error: %s" % err) except: log.warning("Point of entry exited with error: %s" % last_exception_as_string()) log.debug("Full traceback:\n" + last_traceback())
project.add_point_of_entry(poe) return project.get_point_of_entry(name) def add_and_update_points_of_entry(project): count = 0 for path in python_modules_below(project.get_points_of_entry_path()): poe = ensure_point_of_entry(project, path) if poe.is_out_of_sync(): count += 1 return count def inspect_project_statically(project): return add_and_update_modules(project) + \ add_and_update_points_of_entry(project) def inspect_project_dynamically(project): if project.points_of_entry and hasattr(generator_has_ended, 'unreliable'): log.warning("Pure Python implementation of util.generator_has_ended is " "not reliable on Python 2.4 and lower. Please compile the " "_util module or use Python 2.5 or higher.") for poe in project.points_of_entry.values(): try: log.info("Inspecting point of entry %s." % poe.name) dynamic.inspect_point_of_entry(poe) except SyntaxError, err: log.warning("Point of entry contains a syntax error: %s" % err) except: log.warning("Point of entry exited with error: %s" % last_exception_as_string()) log.debug("Full traceback:\n" + last_traceback())