コード例 #1
0
def generate_tests(modules, force, template):
    try:
        project = Project.from_directory(find_project_directory(modules[0]))
        inspect_project(project)
        add_tests_to_project(project, modules, template, force)
        project.save()
    except PythoscopeDirectoryMissing:
        fail("Can't find .pythoscope/ directory for this project. "
             "Initialize the project with the '--init' option first.")
    except ModuleNeedsAnalysis as err:
        if err.out_of_sync:
            fail("Tried to generate tests for test module located at %r, "
                 "but it has been modified during this run. Please try "
                 "running pythoscope again." % err.path)
        else:
            fail("Tried to generate tests for test module located at %r, "
                 "but it was created during this run. Please try running "
                 "pythoscope again." % err.path)
    except ModuleNotFound as err:
        if os.path.exists(err.module):
            fail("Couldn't find information on module %r. This shouldn't "
                 "happen, please file a bug report at %s." % (err.module, BUGTRACKER_URL))
        else:
            fail("File doesn't exist: %s." % err.module)
    except ModuleSaveError as err:
        fail("Couldn't save module %r: %s." % (err.module, err.reason))
    except UnknownTemplate as err:
        fail("Couldn't find template named %r. Available templates are "
             "'nose' and 'unittest'." % err.template)
コード例 #2
0
def start():
    global project, tracer, inspector
    try:
        project = Project.from_directory(find_project_directory(os.getcwd()))
        execution = Execution(project)
        inspector = Inspector(execution)
        tracer = Tracer(inspector)
        tracer.btracer.setup()
        sys.settrace(tracer.tracer)
    except PythoscopeDirectoryMissing:
        print "Can't find .pythoscope/ directory for this project. " \
            "Initialize the project with the '--init' option first. " \
            "Pythoscope tracing disabled for this run."
コード例 #3
0
def init_project(path, skip_inspection=False):
    pythoscope_path = get_pythoscope_path(path)

    try:
        log.debug("Initializing .pythoscope directory: %s" % (os.path.abspath(pythoscope_path)))
        os.makedirs(pythoscope_path)
        os.makedirs(get_points_of_entry_path(path))
        os.makedirs(get_code_trees_path(path))
    except OSError as err:
        fail("Couldn't initialize Pythoscope directory: %s." % err.strerror)

    project = Project.from_directory(path)
    if not skip_inspection:
        log.debug("Performing initial static inspection of the project source code.")
        inspect_project_statically(project)
    project.save()
コード例 #4
0
ファイル: cmdline.py プロジェクト: terminiter/pythoscope
def generate_tests(modules, force, template):
    try:
        project = Project.from_directory(find_project_directory(modules[0]))
        inspect_project(project)
        add_tests_to_project(project, modules, template, force)
        project.save()
    except PythoscopeDirectoryMissing:
        fail("Can't find .pythoscope/ directory for this project. "
             "Initialize the project with the '--init' option first.")
    except ModuleNeedsAnalysis, err:
        if err.out_of_sync:
            fail("Tried to generate tests for test module located at %r, "
                 "but it has been modified during this run. Please try "
                 "running pythoscope again." % err.path)
        else:
            fail("Tried to generate tests for test module located at %r, "
                 "but it was created during this run. Please try running "
                 "pythoscope again." % err.path)
コード例 #5
0
ファイル: cmdline.py プロジェクト: adamhaapala/pythoscope
def generate_tests(modules, force, template):
    try:
        project = Project.from_directory(find_project_directory(modules[0]))
        inspect_project(project)
        add_tests_to_project(project, modules, template, force)
        project.save()
    except PythoscopeDirectoryMissing:
        fail("Can't find .pythoscope/ directory for this project. "
             "Initialize the project with the '--init' option first.")
    except ModuleNeedsAnalysis, err:
        if err.out_of_sync:
            fail("Tried to generate tests for test module located at %r, "
                 "but it has been modified during this run. Please try "
                 "running pythoscope again." % err.path)
        else:
            fail("Tried to generate tests for test module located at %r, "
                 "but it was created during this run. Please try running "
                 "pythoscope again." % err.path)
コード例 #6
0
ファイル: cmdline.py プロジェクト: terminiter/pythoscope
        return find_project_directory(os.path.join(path, os.path.pardir))


def init_project(path, skip_inspection=False):
    pythoscope_path = get_pythoscope_path(path)

    try:
        log.debug("Initializing .pythoscope directory: %s" %
                  (os.path.abspath(pythoscope_path)))
        os.makedirs(pythoscope_path)
        os.makedirs(get_points_of_entry_path(path))
        os.makedirs(get_code_trees_path(path))
    except OSError, err:
        fail("Couldn't initialize Pythoscope directory: %s." % err.strerror)

    project = Project.from_directory(path)
    if not skip_inspection:
        log.debug(
            "Performing initial static inspection of the project source code.")
        inspect_project_statically(project)
    project.save()


def generate_tests(modules, force, template):
    try:
        project = Project.from_directory(find_project_directory(modules[0]))
        inspect_project(project)
        add_tests_to_project(project, modules, template, force)
        project.save()
    except PythoscopeDirectoryMissing:
        fail("Can't find .pythoscope/ directory for this project. "
コード例 #7
0
ファイル: cmdline.py プロジェクト: adamhaapala/pythoscope
        return path
    else:
        return find_project_directory(os.path.join(path, os.path.pardir))

def init_project(path, skip_inspection=False):
    pythoscope_path = get_pythoscope_path(path)

    try:
        log.debug("Initializing .pythoscope directory: %s" % (os.path.abspath(pythoscope_path)))
        os.makedirs(pythoscope_path)
        os.makedirs(get_points_of_entry_path(path))
        os.makedirs(get_code_trees_path(path))
    except OSError, err:
        fail("Couldn't initialize Pythoscope directory: %s." % err.strerror)

    project = Project.from_directory(path)
    if not skip_inspection:
        log.debug("Performing initial static inspection of the project source code.")
        inspect_project_statically(project)
    project.save()

def generate_tests(modules, force, template):
    try:
        project = Project.from_directory(find_project_directory(modules[0]))
        inspect_project(project)
        add_tests_to_project(project, modules, template, force)
        project.save()
    except PythoscopeDirectoryMissing:
        fail("Can't find .pythoscope/ directory for this project. "
             "Initialize the project with the '--init' option first.")
    except ModuleNeedsAnalysis, err: