def setUp(self): super(MultiProjectRefactoringTest, self).setUp() self.project1 = testutils.sample_project(foldername="testproject1") self.project2 = testutils.sample_project(foldername="testproject2") self.mod1 = self.project1.root.create_file("mod1.py") self.other = self.project1.root.create_file("other.py") self.mod2 = self.project2.root.create_file("mod2.py")
def setUp(self): super(MultiProjectRefactoringTest, self).setUp() self.project1 = testutils.sample_project(foldername='testproject1') self.project2 = testutils.sample_project(foldername='testproject2') self.mod1 = self.project1.root.create_file('mod1.py') self.other = self.project1.root.create_file('other.py') self.mod2 = self.project2.root.create_file('mod2.py')
def setUp(self): super(AutoImportTest, self).setUp() self.project = testutils.sample_project(extension_modules=["sys"]) self.mod1 = testutils.create_module(self.project, "mod1") self.pkg = testutils.create_package(self.project, "pkg") self.mod2 = testutils.create_module(self.project, "mod2", self.pkg) self.importer = autoimport.AutoImport(self.project, observe=False)
def setUp(self): super(AutoImportObservingTest, self).setUp() self.project = testutils.sample_project() self.mod1 = testutils.create_module(self.project, "mod1") self.pkg = testutils.create_package(self.project, "pkg") self.mod2 = testutils.create_module(self.project, "mod2", self.pkg) self.importer = autoimport.AutoImport(self.project, observe=True)
def setUp(self): super(OutOfProjectTest, self).setUp() self.test_directory = 'temp_test_directory' testutils.remove_recursively(self.test_directory) os.mkdir(self.test_directory) self.project = testutils.sample_project() self.no_project = NoProject()
def test_setting_ignored_resources(self): self.project = testutils.sample_project( ignored_resources=['myfile.txt']) myfile = self.project.get_file('myfile.txt') file2 = self.project.get_file('file2.txt') self.assertTrue(self.project.is_ignored(myfile)) self.assertFalse(self.project.is_ignored(file2))
def setUp(self): super(GenerateTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.mod = testutils.create_module(self.project, 'mod1') self.mod2 = testutils.create_module(self.project, 'mod2') self.pkg = testutils.create_package(self.project, 'pkg')
def test_ignored_resources_and_get_files(self): self.project = testutils.sample_project( ignored_resources=['myfile.txt'], ropefolder=None) myfile = self.project.get_file('myfile.txt') self.assertEquals(0, len(self.project.get_files())) myfile.create() self.assertEquals(0, len(self.project.get_files()))
def test_ignoring_syntax_errors(self): self.project = testutils.sample_project(ropefolder=None, ignore_syntax_errors=True) pycore = self.project.pycore mod = testutils.create_module(self.project, 'mod') mod.write('xyz print') pymod = pycore.resource_to_pyobject(mod)
def test_star_should_not_include_slashes(self): self.project = testutils.sample_project(ignored_resources=["f*.txt"]) folder = self.project.root.create_folder("folder") file1 = folder.create_file("myfile.txt") file2 = folder.create_file("file2.txt") self.assertFalse(self.project.is_ignored(file1)) self.assertTrue(self.project.is_ignored(file2))
def test_star_should_not_include_slashes(self): self.project = testutils.sample_project(ignored_resources=['f*.txt']) folder = self.project.root.create_folder('folder') file1 = folder.create_file('myfile.txt') file2 = folder.create_file('file2.txt') self.assertFalse(self.project.is_ignored(file1)) self.assertTrue(self.project.is_ignored(file2))
def setUp(self): unittest.TestCase.setUp(self) self.project = testutils.sample_project(foldername='sampleproject', ropefolder=None) self.project_root = self.project.address self._make_sample_project() self.no_project = NoProject()
def setUp(self): super(OutOfProjectTest, self).setUp() self.test_directory = "temp_test_directory" testutils.remove_recursively(self.test_directory) os.mkdir(self.test_directory) self.project = testutils.sample_project() self.no_project = NoProject()
def setUp(self): super(AutoImportTest, self).setUp() self.project = testutils.sample_project() self.mod1 = testutils.create_module(self.project, 'mod1') self.pkg = testutils.create_package(self.project, 'pkg') self.mod2 = testutils.create_module(self.project, 'mod2', self.pkg) self.importer = autoimport.AutoImport(self.project, observe=False)
def setUp(self): super(GenerateTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() self.mod = testutils.create_module(self.project, 'mod1') self.mod2 = testutils.create_module(self.project, 'mod2') self.pkg = testutils.create_package(self.project, 'pkg')
def test_fscommands_and_ignored_resources(self): fscommands = _MockFSCommands() self.project = testutils.sample_project( fscommands=fscommands, ignored_resources=['myfile.txt'], ropefolder=None) myfile = self.project.get_file('myfile.txt') myfile.create() self.assertEquals('', fscommands.log)
def setUp(self): super(ObjectDBTest, self).setUp() self.project = testutils.sample_project() validation = _MockValidation() self.dbs = [ objectdb.ObjectDB(memorydb.MemoryDB(self.project), validation) ]
def test_ignoring_syntax_errors(self): self.project = testutils.sample_project(ropefolder=None, ignore_syntax_errors=True) pycore = self.project.pycore mod = testutils.create_module(self.project, 'mod') mod.write('xyz print') pymod = pycore.resource_to_pyobject(mod) # noqa
def pytest_funcarg__project(request): project = testutils.sample_project() add_gtk_extension_modules(project) project.pycore.hintdb = PyGtkHintProvider(project) project.db = project.pycore.hintdb request.addfinalizer(lambda: testutils.remove_project(project)) return project
def setUp(self): super(AddImportTest, self).setUp() self.project = testutils.sample_project() self.mod1 = testutils.create_module(self.project, "mod1") self.mod2 = testutils.create_module(self.project, "mod2") self.pkg = testutils.create_package(self.project, "pkg") self.mod3 = testutils.create_module(self.project, "mod3", self.pkg)
def setUp(self): super(MoveRefactoringTest, self).setUp() self.project = testutils.sample_project() self.mod1 = testutils.create_module(self.project, 'mod1') self.mod2 = testutils.create_module(self.project, 'mod2') self.mod3 = testutils.create_module(self.project, 'mod3') self.pkg = testutils.create_package(self.project, 'pkg') self.mod4 = testutils.create_module(self.project, 'mod4', self.pkg) self.mod5 = testutils.create_module(self.project, 'mod5', self.pkg)
def setUp(self): super(AddImportTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.mod1 = testutils.create_module(self.project, 'mod1') self.mod2 = testutils.create_module(self.project, 'mod2') self.pkg = testutils.create_package(self.project, 'pkg') self.mod3 = testutils.create_module(self.project, 'mod3', self.pkg)
def setUp(self): super(AddImportTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() self.mod1 = testutils.create_module(self.project, 'mod1') self.mod2 = testutils.create_module(self.project, 'mod2') self.pkg = testutils.create_package(self.project, 'pkg') self.mod3 = testutils.create_module(self.project, 'mod3', self.pkg)
def setUp(self): super(MoveRefactoringTest, self).setUp() self.project = testutils.sample_project() self.mod1 = testutils.create_module(self.project, "mod1") self.mod2 = testutils.create_module(self.project, "mod2") self.mod3 = testutils.create_module(self.project, "mod3") self.pkg = testutils.create_package(self.project, "pkg") self.mod4 = testutils.create_module(self.project, "mod4", self.pkg) self.mod5 = testutils.create_module(self.project, "mod5", self.pkg)
def setUp(self): unittest.TestCase.setUp(self) self.project_root = 'sample_project' self.project = testutils.sample_project(self.project_root) self._make_sample_project() self.fileName = self.sample_file get_sample_editingcontext() self.editor = FileEditor(self.project, self.project.get_resource(self.fileName), GraphicalEditorFactory(Tkinter.Frame()))
def test_ignoring_symlinks_inside_project(self): project2 = testutils.sample_project(folder_name="sampleproject2") mod = project2.root.create_file("mod.py") try: path = os.path.join(self.project.address, "linkedfile.txt") os.symlink(mod.real_path, path) files = self.project.root.get_files() self.assertEquals(1, len(files)) finally: testutils.remove_project(project2)
def test_ignoring_symlinks_inside_project(self): project2 = testutils.sample_project(folder_name='sampleproject2') mod = project2.root.create_file('mod.py') try: path = os.path.join(self.project.address, 'linkedfile.txt') os.symlink(mod.real_path, path) files = self.project.root.get_files() self.assertEquals(1, len(files)) finally: testutils.remove_project(project2)
def setUp(self): super(self.__class__, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() samplemod = testutils.create_module(self.project, 'samplemod') samplemod.write( 'class SampleClass(object):\n def sample_method():\n pass' '\n\ndef sample_func():\n pass\nsample_var = 10\n' '\ndef _underlined_func():\n pass\n\n') package = testutils.create_package(self.project, 'package') nestedmod = testutils.create_module(self.project, 'nestedmod', package)
def setUp(self): super(CodeAssistInProjectsTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore samplemod = testutils.create_module(self.project, 'samplemod') code = 'class SampleClass(object):\n' \ ' def sample_method():\n pass\n\n' \ 'def sample_func():\n pass\n' \ 'sample_var = 10\n\n' \ 'def _underlined_func():\n pass\n\n' samplemod.write(code) package = testutils.create_package(self.project, 'package') nestedmod = testutils.create_module(self.project, 'nestedmod', package)
def setUp(self): super(CodeAssistInProjectsTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() samplemod = testutils.create_module(self.project, 'samplemod') code = 'class SampleClass(object):\n' \ ' def sample_method():\n pass\n\n' \ 'def sample_func():\n pass\n' \ 'sample_var = 10\n\n' \ 'def _underlined_func():\n pass\n\n' samplemod.write(code) package = testutils.create_package(self.project, 'package') nestedmod = testutils.create_module(self.project, 'nestedmod', package)
def test_loading_config_dot_py(self): self.project = testutils.sample_project(ropefolder='.ropeproject') config = self.project.get_file('.ropeproject/config.py') if not config.exists(): config.create() config.write('def set_prefs(prefs):\n' ' prefs["ignored_resources"] = ["myfile.txt"]\n' 'def project_opened(project):\n' ' project.root.create_file("loaded")\n') self.project.close() self.project = Project(self.project.address, ropefolder='.ropeproject') self.assertTrue(self.project.get_file('loaded').exists()) myfile = self.project.get_file('myfile.txt') self.assertTrue(self.project.is_ignored(myfile))
def setUp(self): super(EncapsulateFieldTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.mod = testutils.create_module(self.project, 'mod') self.mod1 = testutils.create_module(self.project, 'mod1') self.a_class = 'class A(object):\n' \ ' def __init__(self):\n' \ ' self.attr = 1\n' self.added_methods = '\n' \ ' def get_attr(self):\n' \ ' return self.attr\n\n' \ ' def set_attr(self, value):\n' \ ' self.attr = value\n' self.encapsulated = self.a_class + self.added_methods
def setUp(self): super(EncapsulateFieldTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() self.mod = testutils.create_module(self.project, 'mod') self.mod1 = testutils.create_module(self.project, 'mod1') self.a_class = 'class A(object):\n' \ ' def __init__(self):\n' \ ' self.attr = 1\n' self.added_methods = '\n' \ ' def get_attr(self):\n' \ ' return self.attr\n\n' \ ' def set_attr(self, value):\n' \ ' self.attr = value\n' self.encapsulated = self.a_class + self.added_methods
def setUp(self): super(ImportUtilsTest, self).setUp() self.project = testutils.sample_project() self.import_tools = ImportTools(self.project) self.mod = testutils.create_module(self.project, "mod") self.pkg1 = testutils.create_package(self.project, "pkg1") self.mod1 = testutils.create_module(self.project, "mod1", self.pkg1) self.pkg2 = testutils.create_package(self.project, "pkg2") self.mod2 = testutils.create_module(self.project, "mod2", self.pkg2) self.mod3 = testutils.create_module(self.project, "mod3", self.pkg2) p1 = testutils.create_package(self.project, "p1") p2 = testutils.create_package(self.project, "p2", p1) p3 = testutils.create_package(self.project, "p3", p2) m1 = testutils.create_module(self.project, "m1", p3) # noqa l = testutils.create_module(self.project, "l", p3) # noqa
def test_loading_config_dot_py(self): self.project = testutils.sample_project(ropefolder=".ropeproject") config = self.project.get_file(".ropeproject/config.py") if not config.exists(): config.create() config.write( dedent("""\ def set_prefs(prefs): prefs["ignored_resources"] = ["myfile.txt"] def project_opened(project): project.root.create_file("loaded") """)) self.project.close() self.project = Project(self.project.address, ropefolder=".ropeproject") self.assertTrue(self.project.get_file("loaded").exists()) myfile = self.project.get_file("myfile.txt") self.assertTrue(self.project.is_ignored(myfile))
def setUp(self): super(ImportUtilsTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.get_pycore() self.import_tools = ImportTools(self.pycore) self.mod = testutils.create_module(self.project, 'mod') self.pkg1 = testutils.create_package(self.project, 'pkg1') self.mod1 = testutils.create_module(self.project, 'mod1', self.pkg1) self.pkg2 = testutils.create_package(self.project, 'pkg2') self.mod2 = testutils.create_module(self.project, 'mod2', self.pkg2) self.mod3 = testutils.create_module(self.project, 'mod3', self.pkg2) p1 = testutils.create_package(self.project, 'p1') p2 = testutils.create_package(self.project, 'p2', p1) p3 = testutils.create_package(self.project, 'p3', p2) m1 = testutils.create_module(self.project, 'm1', p3) l = testutils.create_module(self.project, 'l', p3)
def setUp(self): super(ImportUtilsTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.import_tools = ImportTools(self.pycore) self.mod = testutils.create_module(self.project, 'mod') self.pkg1 = testutils.create_package(self.project, 'pkg1') self.mod1 = testutils.create_module(self.project, 'mod1', self.pkg1) self.pkg2 = testutils.create_package(self.project, 'pkg2') self.mod2 = testutils.create_module(self.project, 'mod2', self.pkg2) self.mod3 = testutils.create_module(self.project, 'mod3', self.pkg2) p1 = testutils.create_package(self.project, 'p1') p2 = testutils.create_package(self.project, 'p2', p1) p3 = testutils.create_package(self.project, 'p3', p2) m1 = testutils.create_module(self.project, 'm1', p3) l = testutils.create_module(self.project, 'l', p3)
def setUp(self): super(EncapsulateFieldTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.mod = testutils.create_module(self.project, "mod") self.mod1 = testutils.create_module(self.project, "mod1") self.a_class = dedent("""\ class A(object): def __init__(self): self.attr = 1 """) self.added_methods = ("\n" " def get_attr(self):\n" " return self.attr\n\n" " def set_attr(self, value):\n" " self.attr = value\n") self.encapsulated = self.a_class + self.added_methods
def test_compressed_history(self): self.project = testutils.sample_project(compress_history=True) mod = testutils.create_module(self.project, "mod") mod.write("")
def setUp(self): super(ScopeNameFinderTest, self).setUp() self.project = testutils.sample_project()
def test_normal_fscommands(self): fscommands = _MockFSCommands() self.project = testutils.sample_project(fscommands=fscommands) myfile = self.project.get_file('myfile.txt') myfile.create() self.assertTrue('create_file ', fscommands.log)
def test_ignored_resources_and_prefixes(self): self.project = testutils.sample_project(ignored_resources=['.hg']) myfile = self.project.root.create_file('.hgignore') self.assertFalse(self.project.is_ignored(myfile))
def test_nested_dot_ropeproject_folder(self): self.project = testutils.sample_project(ropefolder=".f1/f2") ropefolder = self.project.ropefolder self.assertEquals(".f1/f2", ropefolder.path) self.assertTrue(ropefolder.exists())
def test_compressed_objectdb(self): self.project = testutils.sample_project(compress_objectdb=True) mod = testutils.create_module(self.project, "mod") self.project.pycore.analyze_module(mod)
def setUp(self): super(PythonFileRunnerTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore
def test_ignored_folders(self): self.project = testutils.sample_project(ignored_resources=['myfolder']) myfolder = self.project.root.create_folder('myfolder') self.assertTrue(self.project.is_ignored(myfolder)) myfile = myfolder.create_file('myfile.txt') self.assertTrue(self.project.is_ignored(myfile))
def test_getting_project_rope_folder(self): self.project = testutils.sample_project(ropefolder='.ropeproject') self.assertTrue(self.project.ropefolder.exists()) self.assertTrue('.ropeproject', self.project.ropefolder.path)
def test_none_project_rope_folder(self): self.project = testutils.sample_project(ropefolder=None) self.assertTrue(self.project.ropefolder is None)
def setUp(self): super(RestructureTest, self).setUp() self.project = testutils.sample_project() self.pycore = self.project.pycore self.mod = testutils.create_module(self.project, 'mod')
def setUp(self): super(ResourceObserverTest, self).setUp() self.project = testutils.sample_project()
def test_nested_dot_ropeproject_folder(self): self.project = testutils.sample_project(ropefolder='.f1/f2') ropefolder = self.project.ropefolder self.assertEquals('.f1/f2', ropefolder.path) self.assertTrue(ropefolder.exists())