Ronald Oussoren avatar Ronald Oussoren committed fb77eed

Initial wrapping of the SenTestingKit framework

Comments (0)

Files changed (9)

Lib/SenTestingKit/__init__.py

+"""
+Python mapping for the Cocoa SenTestingKit.
+
+This module does not contain docstrings for the wrapped code, check Apple's
+documentation for details on how to use these functions and classes.
+"""
+
+import SenTestingKit as _AppKit
+import objc as _objc
+
+# We first register special methods signatures with the runtime. The module
+# is not used for anything else.
+
+from _SenTestingKit import *
+
+# Load the Cocoa bundle, and gather all classes defined there
+
+if _objc.platform == 'MACOSX':
+    _objc.loadBundle(
+        "SenTestingKit",
+        globals(),
+        bundle_identifier=u'ch.sente.SenTestingKit',
+    )
+else:
+    _objc.loadBundle(
+        "SenTestingKit",
+        globals(),
+        bundle_path=_objc.pathForFramework(
+            u"/System/Library/Frameworks/SenTestingKit.framework",
+        ),
+    )
+
+import protocols  # no need to export these, just register with PyObjC

Lib/SenTestingKit/protocols.py

+# generated from '/System/Library/Frameworks/SenTestingKit.framework'
+import objc as _objc
+
+
Add a comment to this file

Lib/SenTestingKit/test/__init__.py

Empty file added.

Lib/SenTestingKit/test/test_loaded.py

+"""
+SenTestingKit doesn't add 'interesting' behaviour, just check that the
+module loaded correctly.
+"""
+
+import unittest
+
+import os
+import objc
+
+if os.path.exists('/System/Library/Frameworks/SenTestingKit.framework'):
+    class SenTestingKitTests (unittest.TestCase):
+
+        def testConstants(self):
+            import SenTestingKit
+
+            self.assert_(hasattr(SenTestingKit, 'SenTestFailureException'))
+
+            self.assert_(isinstance(SenTestingKit.SenTestFailureException, unicode))
+
+        def testClasses(self):
+            # Check that we loaded the SenTestingKit framework by looking for a
+            # class that should exist
+            import SenTestingKit
+
+            self.assert_(hasattr(SenTestingKit, 'SenInterfaceTestCase'))
+            self.assert_(isinstance(SenTestingKit.SenInterfaceTestCase, objc.objc_class))
+
+
+if __name__ == "__main__":
+    unittest.main()

Modules/SenTestingKit/_SenTestingKit.m

+/*
+ * Mapping of static items in the SenTestingKit framework
+ */
+#include <Python.h>
+
+#import <SenTestingKit/SenTestingKit.h>
+#import <CoreFoundation/CoreFoundation.h>
+
+#include "pyobjc-api.h"
+#include "wrapper-const-table.h"
+
+static PyMethodDef ib_methods[] = {
+	{ 0, 0, 0, 0 }
+};
+
+
+PyDoc_STRVAR(ib_doc,
+"SenTestingKit._SenTestingKit defines constants, types and global functions used by "
+"SenTestingKit"
+);
+
+
+#include "_SenTestingKit_Enum.inc"
+#include "_SenTestingKit_Str.inc"
+
+void init_SenTestingKit(void);
+
+void init_SenTestingKit(void)
+{
+	PyObject *m, *d;
+	CFBundleRef bundle;
+
+	m = Py_InitModule4("_SenTestingKit", ib_methods, 
+		ib_doc, NULL, PYTHON_API_VERSION);
+	if (!m) return;
+
+	d = PyModule_GetDict(m);
+	if (!d) return;
+
+	if (PyObjC_ImportAPI(m) < 0) {
+		return;
+	}
+
+	bundle = CFBundleGetBundleWithIdentifier(CFSTR("ch.sente.SenTestingKit"));
+
+	if (register_ints(d, enum_table) < 0) return;
+	if (register_variableList(d, bundle, string_table, 
+		(sizeof(string_table)/sizeof(string_table[0]))-1) < 0) return;
+
+	//CFRelease(bundle);
+}
   Intel ABI has not been finalised yet. It is also possible to build fat
   binaries, that option should not be used in production builds.
 
+- Support a number of new frameworks:
+
+  * SenTestingKit
+    
+    TODO: this framework uses lots of macros (such as STAssertEquals), these
+    have not yet been wrapped/converted.
+
+  * SecurityFoundation
+
+
 Version 1.3.6 (2005-05-19)
 --------------------------
 

Scripts/CodeGenerators/cocoa_generator.py

     QUARTZ2_HDRS=pathjoin(FRAMEWORKS, "Quartz.framework", "Frameworks", "QuartzComposer.framework", "Headers")
     QUARTZ3_HDRS=pathjoin(FRAMEWORKS, "Quartz.framework", "Frameworks", "PDFKit.framework", "Headers")
     OSAKIT_HDRS=pathjoin(FRAMEWORKS, "OSAKit.framework", "Headers")
+    SENTESTINGKIT_HDRS=pathjoin(FRAMEWORKS, "SenTestingKit.framework", "Headers")
 
 else:
     # This is probably incorrect, and was added to help a future
     strconst_generator.generate(
             QUARTZ3_HDRS,
             'build/codegen/_Quartz3_Str.inc', emit_header=0)
+
+if SENTESTINGKIT_HDRS is not None:
+    enum_generator.generate(
+            SENTESTINGKIT_HDRS,
+            'build/codegen/_SenTestingKit_Enum.inc')
+    strconst_generator.generate(
+            SENTESTINGKIT_HDRS,
+            'build/codegen/_SenTestingKit_Str.inc')

Scripts/gen_all_protocols.py

         "WebKit", "ExceptionHandling", "SecurityInterface", "AppleScriptKit",
         "Automator", "CoreData", "XgridFoundation",
         "SyncServices", "DiscRecording", "DiscRecordingUI", 'QTKit', "OSAKit",
+        "SenTestingKit",
         ]:
     path = "/System/Library/Frameworks/%s.framework" % framework
     protfile = file(os.path.join(libdir, framework, "protocols.py"), "w")
     SECURITY_INTERFACE_LDFLAGS = frameworks('CoreFoundation', 'SecurityInterface', 'Foundation')
     EXCEPTION_HANDLING_LDFLAGS = frameworks('CoreFoundation', 'ExceptionHandling', 'Foundation')
     PREFPANES_LDFLAGS = frameworks('CoreFoundation', 'PreferencePanes', 'Foundation')
+    SENTESTINGKIT_LDFLAGS = frameworks('Foundation')
 
     BASE_LDFLAGS = []
     if AUTO_UNIVERSAL:
 QTKitDepends = dict(depends=INCFILES)
 QuartzDepends = dict(depends=INCFILES)
 OSAKitDepends = dict(depends=INCFILES)
+SenTestingKitDepends = dict(depends=INCFILES)
 
 FoundationPackages, FoundationExtensions = \
         IfFrameWork('Foundation.framework', [ 'Foundation' ], [
                       ),
         ])
 
+SenTestingKitPackages, SenTestingKitExtensions = \
+        IfFrameWork('SenTestingKit.framework', [ 'SenTestingKit' ], [
+            Extension('SenTestingKit._SenTestingKit',
+                      [ 'Modules/SenTestingKit/_SenTestingKit.m' ],
+                      extra_compile_args=[
+                        '-IModules/objc',
+                      ] + CFLAGS,
+                      extra_link_args=frameworks(
+                        'SenTestingKit',
+                        'Foundation'
+                      ),
+                      **SenTestingKitDepends
+                      ),
+        ])
+
 WebKitPackages, WebKitExtensions = \
         IfFrameWork('WebKit.framework', [ 'WebKit' ], [
             Extension('WebKit._WebKit',
     QTKitPackages +
     QuartzPackages +
     OSAKitPackages +
+    SenTestingKitPackages +
 
     [
         'PyObjCTools',
        + DiscRecordingUIExtensions
        + SyncServicesExtensions
        + XgridFoundationExtensions
+       + SenTestingKitExtensions
 
     ),
     packages = packages,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.