Beispiel #1
0
class PointOfEntry(Localizable):
    """Piece of code provided by the user that allows dynamic analysis.

    Each point of entry keeps a reference to its last run in the `execution`
    attribute.
    """
    def __init__(self, project, name):
        Localizable.__init__(self, project, project.subpath_for_point_of_entry(name))

        self.project = project
        self.name = name
        self.execution = Execution(project)

    def _get_created(self):
        "Points of entry are not up-to-date until they're run."
        return self.execution.ended or 0
    def _set_created(self, value):
        pass
    created = property(_get_created, _set_created)

    def get_path(self):
        return self.project.path_for_point_of_entry(self.name)

    def get_content(self):
        return read_file_contents(self.get_path())

    def clear_previous_run(self):
        self.execution.destroy()
        self.execution = Execution(self.project)
Beispiel #2
0
class PointOfEntry(Localizable):
    """Piece of code provided by the user that allows dynamic analysis.

    Each point of entry keeps a reference to its last run in the `execution`
    attribute.
    """
    def __init__(self, project, name):
        Localizable.__init__(self, project,
                             project.subpath_for_point_of_entry(name))

        self.project = project
        self.name = name
        self.execution = Execution(project)

    def _get_created(self):
        "Points of entry are not up-to-date until they're run."
        return self.execution.ended or 0

    def _set_created(self, value):
        pass

    created = property(_get_created, _set_created)

    def get_path(self):
        return self.project.path_for_point_of_entry(self.name)

    def get_content(self):
        return read_file_contents(self.get_path())

    def clear_previous_run(self):
        self.execution.destroy()
        self.execution = Execution(self.project)
Beispiel #3
0
    def __init__(self, project, name):
        Localizable.__init__(self, project,
                             project.subpath_for_point_of_entry(name))

        self.project = project
        self.name = name
        self.execution = Execution(project)
Beispiel #4
0
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
Beispiel #5
0
def EmptyProjectExecution():
    return Execution(EmptyProject())
Beispiel #6
0
 def make_new_execution(self):
     return Execution(project=self)
Beispiel #7
0
 def clear_previous_run(self):
     self.execution.destroy()
     self.execution = Execution(self.project)
Beispiel #8
0
    def __init__(self, project, name):
        Localizable.__init__(self, project, project.subpath_for_point_of_entry(name))

        self.project = project
        self.name = name
        self.execution = Execution(project)
Beispiel #9
0
 def clear_previous_run(self):
     self.execution.destroy()
     self.execution = Execution(self.project)