本文整理汇总了Python中rope.base.project.Project.is_ignored方法的典型用法代码示例。如果您正苦于以下问题:Python Project.is_ignored方法的具体用法?Python Project.is_ignored怎么用?Python Project.is_ignored使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rope.base.project.Project
的用法示例。
在下文中一共展示了Project.is_ignored方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RopeFolderTest
# 需要导入模块: from rope.base.project import Project [as 别名]
# 或者: from rope.base.project.Project import is_ignored [as 别名]
class RopeFolderTest(unittest.TestCase):
def setUp(self):
super(RopeFolderTest, self).setUp()
self.project = None
def tearDown(self):
if self.project:
testutils.remove_project(self.project)
super(RopeFolderTest, self).tearDown()
def test_none_project_rope_folder(self):
self.project = testutils.sample_project(ropefolder=None)
self.assertTrue(self.project.ropefolder is None)
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_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 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_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_ignored_resources_and_get_files2(self):
self.project = testutils.sample_project(ignored_resources=["myfile.txt"], ropefolder=None)
myfile = self.project.root.create_file("myfile.txt")
self.assertEquals(0, len(self.project.get_files()))
def test_setting_ignored_resources_patterns(self):
self.project = testutils.sample_project(ignored_resources=["m?file.*"])
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 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_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_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 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_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 test_ignoring_syntax_errors(self):
self.project = testutils.sample_project(ropefolder=None, ignore_syntax_errors=True)
#.........这里部分代码省略.........
示例2: RopeFolderTest
# 需要导入模块: from rope.base.project import Project [as 别名]
# 或者: from rope.base.project.Project import is_ignored [as 别名]
class RopeFolderTest(unittest.TestCase):
def setUp(self):
super(RopeFolderTest, self).setUp()
self.project = None
def tearDown(self):
if self.project:
testutils.remove_project(self.project)
super(RopeFolderTest, self).tearDown()
def test_none_project_rope_folder(self):
self.project = testutils.sample_project(ropefolder=None)
self.assertTrue(self.project.ropefolder is None)
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_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 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_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_ignored_resources_and_get_files2(self):
self.project = testutils.sample_project(
ignored_resources=['myfile.txt'], ropefolder=None)
myfile = self.project.root.create_file('myfile.txt') # noqa
self.assertEquals(0, len(self.project.get_files()))
def test_setting_ignored_resources_patterns(self):
self.project = testutils.sample_project(ignored_resources=['m?file.*'])
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 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_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_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 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_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))
#.........这里部分代码省略.........