def init_pyscope(self, fpath): """ initialize pyscope with codebase""" pythoscope_workspace = (fpath + path('/.pythoscope')) if pythoscope_workspace.exists(): from kinbaku.util import remove_recursively remove_recursively(pythoscope_workspace) init_project(fpath)
def make_tests(self): """ self.tests_files[0].startswith(self.codebase.project.address) self.tests_files[0][len(self.codebase.project.address):] """ remove_recursively(self.tests_folder) #remove_recursively(self.tests_folder) files = self.codebase.python_files files = [self.codebase%fpath for fpath in files] from pythoscope import generate_tests generate_tests(files, force=False, template='unittest')
def init_pyscope(self, fpath): """ initialize pythoscope with codebase ( will be <codebase-shadow>/.pythonscope ) """ from pythoscope import init_project self.workspace = (fpath + path('/.pythoscope')) if self.workspace.exists(): report("Workspace exists.. wiping it") from kinbaku.util import remove_recursively remove_recursively(self.workspace) init_project(fpath)
def __exit__(self, type, value, tb): if self.debug: console.draw_line(msg=" __exit__ ") if not any([type, value, tb]): if self.debug: report(" closing project:", self.project.close()) report(" removing shadow", remove_recursively(self.pth_shadow)) else: report("exit with error", type, value, tb)
def __rshift__(self,fpath): """ mirrors a fpath into sandbox: if this is called multiple times, it will get a fresh copy of the originating file each time.. """ if self.debug: report('mirroring "{fpath}" in sandbox', fpath=fpath.name) namebase = fpath.namebase try: mod = generate.create_module(self.project, namebase) except RopeError,e: if "already exists" in str(e): ## Should not get here because we're wiping existing projects, right? name_would_be = os.path.join(self.pth_shadow, fpath.name) if os.path.exists(name_would_be): remove_recursively(name_would_be) return self>>fpath else: raise Exception,['wait, what?', str(e), name_would_be] else: raise e