def __init__(self, path): self.path = path p = WorkspaceParser() with open(self.path, 'r') as f: p.parse(f.read()) self.filerefs = p.workspace.filerefs self.projects = filter(lambda fileref: fileref.endswith('.xcodeproj'), p.workspace.filerefs)
def test_fixture_GraphSketcher(self): p = self.load(WorkspaceParser(), 'test/GraphSketcher.xml') self.assertIn(WorkspaceParser.FileRefItem('group:GraphSketcher/iPad/GraphSketcher-iPad.xcodeproj'),\ p.workspace.filerefs) self.assertIn(WorkspaceParser.FileRefItem('group:OmniGroup/Tools/FixStringsFile/FixStringsFile.xcodeproj'),\ p.workspace.group('Tools').filerefs) self.assertEquals(len(p.workspace.filerefs), 1)
def test_fixture_AFNetworking(self): p = self.load(WorkspaceParser(), 'test/AFNetworking.xml') self.assertIn(WorkspaceParser.FileRefItem('group:Tests/AFNetworking Tests.xcodeproj'),\ p.workspace.filerefs) self.assertIn(WorkspaceParser.FileRefItem('group:Example/AFNetworking iOS Example.xcodeproj'),\ p.workspace.filerefs) self.assertIn(WorkspaceParser.FileRefItem('group:AFNetworking.h'),\ p.workspace.group('AFNetworking').filerefs) self.assertEquals(len(p.workspace.group('AFNetworking').groups), 5)
from workspaceparser import Parser as WorkspaceParser p = WorkspaceParser() with open('test/AFNetworking.xml', 'r') as f: p.parse(f.read()) print p.workspace.version # should print '1.0' print filter(lambda fileref: fileref.path.endswith('.xcodeproj'), p.workspace.filerefs) # should print all xcodeprojects for group in p.workspace.groups: print group
def test_recursion_bug(self): p = self.load(WorkspaceParser(), 'test/bugRecursionDepth.xml') self.assertIn( WorkspaceParser.FileRefItem( 'group:TMQuiltViewDemo/TMQuiltViewDemo.xcodeproj'), p.workspace.filerefs)