Commits

Ronald Oussoren committed c831acb

Port to py3k

Comments (0)

Files changed (18)

pyobjc-framework-SystemConfiguration/Modules/_manual.m

 	{ 0, 0, 0, 0 } /* sentinel */
 };
 
-void init_manual(void);
+PyObjC_MODULE_INIT(_manual)
+{
+	PyObject* m = PyObjC_MODULE_CREATE(_manual);
+	if (!m) {
+		PyObjC_INITERROR();
+	}
 
-void
-init_manual(void)
-{
-	PyObject* m = Py_InitModule4("_manual", mod_methods,
-			mod_doc, NULL, PYTHON_API_VERSION);
+	if (PyObjC_ImportAPI(m) < 0) { 
+		PyObjC_INITERROR();
+	}
 
-	if (PyObjC_ImportAPI(m) < 0) { return; }
+	PyObjC_INITDONE();
 }

pyobjc-framework-SystemConfiguration/Modules/pyobjc-api.h

-#ifndef PyObjC_API_H
-#define PyObjC_API_H
-
-/*
- * Use this in helper modules for the objc package, and in wrappers
- * for functions that deal with objective-C objects/classes
- * 
- * This header defines some utility wrappers for importing and using 
- * the core bridge. 
- *
- * This is the *only* header file that should be used to access 
- * functionality in the core bridge.
- *
- * WARNING: this file is not part of the public interface of PyObjC and
- * might change or be removed without warning or regard for backward
- * compatibility.
- */
-
-#include "Python.h"
-#include <objc/objc.h>
-
-#ifndef PyObjC_COMPAT_H
-#if (PY_VERSION_HEX < 0x02050000)
-typedef int Py_ssize_t;
-#define PY_FORMAT_SIZE_T ""
-#define Py_ARG_SIZE_T "n"
-#define PY_SSIZE_T_MAX INT_MAX
-
-#else
-
-#define Py_ARG_SIZE_T "i"
-#endif
-#endif
-
-
-#import <Foundation/NSException.h>
-
-struct PyObjC_WeakLink {
-	const char* name;
-	void (*func)(void);
-};
-
-
-/* threading support */
-#define PyObjC_DURING \
-		Py_BEGIN_ALLOW_THREADS \
-		NS_DURING
-
-#define PyObjC_HANDLER NS_HANDLER
-
-#define PyObjC_ENDHANDLER \
-		NS_ENDHANDLER \
-		Py_END_ALLOW_THREADS
-
-#define PyObjC_BEGIN_WITH_GIL \
-	{ \
-		PyGILState_STATE _GILState; \
-		_GILState = PyGILState_Ensure(); 
-
-#define PyObjC_GIL_FORWARD_EXC() \
-		do { \
-            PyObjCErr_ToObjCWithGILState(&_GILState); \
-		} while (0)
-
-
-#define PyObjC_GIL_RETURN(val) \
-		do { \
-			PyGILState_Release(_GILState); \
-			return (val); \
-		} while (0)
-
-#define PyObjC_GIL_RETURNVOID \
-		do { \
-			PyGILState_Release(_GILState); \
-			return; \
-		} while (0)
-
-
-#define PyObjC_END_WITH_GIL \
-		PyGILState_Release(_GILState); \
-	}
-
-
-
-#include <objc/objc-runtime.h>
-
-/* On 10.1 there are no defines for the OS version. */
-#ifndef MAC_OS_X_VERSION_10_1
-#define MAC_OS_X_VERSION_10_1 1010
-#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_1
-
-#error "MAC_OS_X_VERSION_10_1 not defined. You aren't running 10.1 are you?"
-
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_2
-#define MAC_OS_X_VERSION_10_2 1020
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_3
-#define MAC_OS_X_VERSION_10_3 1030
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
-
-#ifndef MAC_OS_X_VERSION_10_5
-#define MAC_OS_X_VERSION_10_5 1050
-#endif
-
-/* Current API version, increase whenever:
- * - Semantics of current functions change
- * - Functions are removed
- * Do not increase when adding a new function, the struct_len field
- * can be used for detecting if a function has been added.
- *
- * HISTORY:
- * - Version 2.2 adds PyObjCUnsupportedMethod_IMP 
- *       and PyObjCUnsupportedMethod_Caller 
- * - Version 2.1 adds PyObjCPointerWrapper_Register 
- * - Version 2 adds an argument to PyObjC_InitSuper
- * - Version 3 adds another argument to PyObjC_CallPython
- * - Version 4 adds PyObjCErr_ToObjCGILState
- * - Version 4.1 adds PyObjCRT_AlignOfType and PyObjCRT_SizeOfType
- *         (PyObjC_SizeOfType is now deprecated)
- * - Version 4.2 adds PyObjCRT_SELName
- * - Version 4.3 adds PyObjCRT_SimplifySignature
- * - Version 4.4 adds PyObjC_FreeCArray, PyObjC_PythonToCArray and
- *   		PyObjC_CArrayToPython
- * - Version 5 modifies the signature for PyObjC_RegisterMethodMapping,
- *	PyObjC_RegisterSignatureMapping and PyObjCUnsupportedMethod_IMP,
- *      adds PyObjC_RegisterStructType and removes PyObjC_CallPython
- * - Version 6 adds PyObjCIMP_Type, PyObjCIMP_GetIMP and PyObjCIMP_GetSelector
- * - Version 7 adds PyObjCErr_AsExc, PyGILState_Ensure
- * - Version 8 adds PyObjCObject_IsUninitialized,
-        removes PyObjCSelector_IsInitializer
- * - Version 9 (???)
- * - Version 10 changes the signature of PyObjCRT_SimplifySignature
- * - Version 11 adds PyObjCObject_Convert, PyObjCSelector_Convert,
-     PyObjCClass_Convert, PyObjC_ConvertBOOL, and PyObjC_ConvertChar
- * - Version 12 adds PyObjCObject_New
- * - Version 13 adds PyObjCCreateOpaquePointerType
- * - Version 14 adds PyObjCObject_NewTransient, PyObjCObject_ReleaseTransient
- * - Version 15 changes the interface of PyObjCObject_New
- * - Version 16 adds PyObjC_PerformWeaklinking
- * - Version 17 introduces Py_ssize_t support
- * - Version 18 introduces several API incompatibilities
- */
-#define PYOBJC_API_VERSION 18
-
-#define PYOBJC_API_NAME "__C_API__"
-
-/* 
- * Only add items to the end of this list!
- */
-typedef int (RegisterMethodMappingFunctionType)(
-			Class, 
-			SEL, 
-			PyObject *(*)(PyObject*, PyObject*, PyObject*),
-			void (*)(void*, void*, void**, void*));
-
-struct pyobjc_api {
-	int	      api_version;	/* API version */
-	size_t	      struct_len;	/* Length of this struct */
-	PyTypeObject* class_type;	/* PyObjCClass_Type    */
-	PyTypeObject* object_type;	/* PyObjCObject_Type   */
-	PyTypeObject* select_type;	/* PyObjCSelector_Type */
-
-	/* PyObjC_RegisterMethodMapping */
-	RegisterMethodMappingFunctionType *register_method_mapping;
-
-	/* PyObjC_RegisterSignatureMapping */
-	int (*register_signature_mapping)(
-			char*,
-			PyObject *(*)(PyObject*, PyObject*, PyObject*),
-			void (*)(void*, void*, void**, void*));
-
-	/* PyObjCObject_GetObject */
-	id (*obj_get_object)(PyObject*);
-
-	/* PyObjCObject_ClearObject */
-	void (*obj_clear_object)(PyObject*);
-
-	/* PyObjCClass_GetClass */
-	Class (*cls_get_class)(PyObject*);
-
-	/* PyObjCClass_New */
-	PyObject* (*cls_to_python)(Class cls);
-
-	/* PyObjC_PythonToId */
-	id (*python_to_id)(PyObject*);
-
-	/* PyObjC_IdToPython */
-	PyObject* (*id_to_python)(id);
-
-	/* PyObjCErr_FromObjC */
-	void (*err_objc_to_python)(NSException*);
-
-	/* PyObjCErr_ToObjC */
-	void (*err_python_to_objc)(void);
-
-	/* PyObjC_PythonToObjC */
-	int (*py_to_objc)(const char*, PyObject*, void*);
-
-	/* PyObjC_ObjCToPython */
-	PyObject* (*objc_to_py)(const char*, void*);
-
-	/* PyObjC_SizeOfType */
-	Py_ssize_t   (*sizeof_type)(const char*);
-
-	/* PyObjCSelector_GetClass */
-	Class	   (*sel_get_class)(PyObject* sel);
-
-	/* PyObjCSelector_GetSelector */
-	SEL	   (*sel_get_sel)(PyObject* sel);
-
-	/* PyObjC_InitSuper */ 	
-	void	(*fill_super)(struct objc_super*, Class, id);
-
-	/* PyObjC_InitSuperCls */
-	void	(*fill_super_cls)(struct objc_super*, Class, Class);
-
-	/* PyObjCPointerWrapper_Register */ 
-	int  (*register_pointer_wrapper)(
-		        const char*, PyObject* (*pythonify)(void*),
-			int (*depythonify)(PyObject*, void*)
-		);
-
-	void (*unsupported_method_imp)(void*, void*, void**, void*);
-	PyObject* (*unsupported_method_caller)(PyObject*, PyObject*, PyObject*);
-
-	/* PyObjCErr_ToObjCWithGILState */
-	void (*err_python_to_objc_gil)(PyGILState_STATE* state);
-
-	/* PyObjCRT_AlignOfType */
-	Py_ssize_t (*alignof_type)(const char* typestr);
-
-	/* PyObjCRT_SELName */
-	const char* (*selname)(SEL sel);
-
-	/* PyObjCRT_SimplifySignature */
-	int (*simplify_sig)(char* signature, char* buf, size_t buflen);
-
-	/* PyObjC_FreeCArray */
-	void    (*free_c_array)(int,void*);
-
-	/* PyObjC_PythonToCArray */
-	int     (*py_to_c_array)(BOOL, BOOL, const char*, PyObject*, void**, Py_ssize_t*, PyObject**);
-	
-	/* PyObjC_CArrayToPython */
-	PyObject* (*c_array_to_py)(const char*, void*, Py_ssize_t);
-
-	/* PyObjC_RegisterStructType */
-	PyObject* (*register_struct)(const char*, const char*, const char*, initproc, Py_ssize_t, const char**);
-
-	/* PyObjCIMP_Type */
-	PyTypeObject* imp_type;
-
-	/* PyObjCIMP_GetIMP */
-	IMP  (*imp_get_imp)(PyObject*);
-
-	/* PyObjCIMP_GetSelector */
-	SEL  (*imp_get_sel)(PyObject*);
-
-	/* PyObjCErr_AsExc */
-	NSException* (*err_python_to_nsexception)(void);
-
-	/* PyGILState_Ensure */
-	PyGILState_STATE (*gilstate_ensure)(void);
-
-	/* PyObjCObject_IsUninitialized */
-	int (*obj_is_uninitialized)(PyObject*);
-
-	/* PyObjCObject_Convert */
-	int (*pyobjcobject_convert)(PyObject*,void*);
-
-	/* PyObjCSelector_Convert */
-	int (*pyobjcselector_convert)(PyObject*,void*);
-
-	/* PyObjCClass_Convert */
-	int (*pyobjcclass_convert)(PyObject*,void*);
-
-	/* PyObjC_ConvertBOOL */
-	int (*pyobjc_convertbool)(PyObject*,void*);
-
-	/* PyObjC_ConvertChar */
-	int (*pyobjc_convertchar)(PyObject*,void*);
-
-	/* PyObjCObject_New */
-	PyObject* (*pyobjc_object_new)(id, int , int);
-
-	/* PyObjCCreateOpaquePointerType */
-	PyObject* (*pointer_type_new)(const char*, const char*, const char*);
-
-	/* PyObject* PyObjCObject_NewTransient(id objc_object, int* cookie); */
-	PyObject* (*newtransient)(id objc_object, int* cookie);
-
-	/* void PyObjCObject_ReleaseTransient(PyObject* proxy, int cookie); */
-	void (*releasetransient)(PyObject* proxy, int cookie);
-
-	void (*doweaklink)(PyObject*, struct PyObjC_WeakLink*);
-
-	const char* (*removefields)(char*, const char*);
-
-	PyObject** pyobjc_null;
-
-	int (*dep_c_array_count)(const char* type, Py_ssize_t count, BOOL strict, PyObject* value, void* datum);
-
-	PyObject* (*varlistnew)(const char* tp, void* array);
-};
-
-#ifndef PYOBJC_BUILD
-
-#ifndef PYOBJC_METHOD_STUB_IMPL
-static struct pyobjc_api*	PyObjC_API;
-#endif /* PYOBJC_METHOD_STUB_IMPL */
-
-#define PyObjCObject_Check(obj) PyObject_TypeCheck(obj, PyObjC_API->object_type)
-#define PyObjCClass_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->class_type)
-#define PyObjCSelector_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->select_type)
-#define PyObjCIMP_Check(obj)  PyObject_TypeCheck(obj, PyObjC_API->imp_type)
-#define PyObjCObject_GetObject (PyObjC_API->obj_get_object)
-#define PyObjCObject_ClearObject (PyObjC_API->obj_clear_object)
-#define PyObjCClass_GetClass   (PyObjC_API->cls_get_class)
-#define PyObjCClass_New 	     (PyObjC_API->cls_to_python)
-#define PyObjCSelector_GetClass (PyObjC_API->sel_get_class)
-#define PyObjCSelector_GetSelector (PyObjC_API->sel_get_sel)
-#define PyObjC_PythonToId      (PyObjC_API->python_to_id)
-#define PyObjC_IdToPython      (PyObjC_API->id_to_python)
-#define PyObjCErr_FromObjC     (PyObjC_API->err_objc_to_python)
-#define PyObjCErr_ToObjC       (PyObjC_API->err_python_to_objc)
-#define PyObjCErr_ToObjCWithGILState       (PyObjC_API->err_python_to_objc_gil)
-#define PyObjCErr_AsExc        (PyObjC_API->err_python_to_nsexception)
-#define PyObjC_PythonToObjC    (PyObjC_API->py_to_objc)
-#define PyObjC_ObjCToPython    (PyObjC_API->objc_to_py)
-#define PyObjC_RegisterMethodMapping (PyObjC_API->register_method_mapping)
-#define PyObjC_RegisterSignatureMapping (PyObjC_API->register_signature_mapping)
-#define PyObjC_SizeOfType      (PyObjC_API->sizeof_type)
-#define PyObjC_PythonToObjC   (PyObjC_API->py_to_objc)
-#define PyObjC_ObjCToPython   (PyObjC_API->objc_to_py)
-#define PyObjC_InitSuper	(PyObjC_API->fill_super)
-#define PyObjC_InitSuperCls	(PyObjC_API->fill_super_cls)
-#define PyObjCPointerWrapper_Register (PyObjC_API->register_pointer_wrapper)
-#define PyObjCUnsupportedMethod_IMP (PyObjC_API->unsupported_method_imp)
-#define PyObjCUnsupportedMethod_Caller (PyObjC_API->unsupported_method_caller)
-#define PyObjCRT_SizeOfType      (PyObjC_API->sizeof_type)
-#define PyObjCRT_AlignOfType	(PyObjC_API->alignof_type)
-#define PyObjCRT_SELName	(PyObjC_API->selname)
-#define PyObjCRT_SimplifySignature	(PyObjC_API->simplify_sig)
-#define PyObjC_FreeCArray	(PyObjC_API->free_c_array)
-#define PyObjC_PythonToCArray	(PyObjC_API->py_to_c_array)
-#define PyObjC_CArrayToPython	(PyObjC_API->c_array_to_py)
-#define PyObjC_RegisterStructType   (PyObjC_API->register_struct)
-#define PyObjCIMP_GetIMP   (PyObjC_API->imp_get_imp)
-#define PyObjCIMP_GetSelector   (PyObjC_API->imp_get_sel)
-#define PyObjCObject_IsUninitialized (PyObjC_API->obj_is_uninitialized)
-#define PyObjCObject_Convert (PyObjC_API->pyobjcobject_convert)
-#define PyObjCSelector_Convert (PyObjC_API->pyobjcselector_convert)
-#define PyObjCClass_Convert (PyObjC_API->pyobjcselector_convert)
-#define PyObjC_ConvertBOOL (PyObjC_API->pyobjc_convertbool)
-#define PyObjC_ConvertChar (PyObjC_API->pyobjc_convertchar)
-#define PyObjCObject_New (PyObjC_API->pyobjc_object_new)
-#define PyObjCCreateOpaquePointerType (PyObjC_API->pointer_type_new)
-#define PyObjCObject_NewTransient (PyObjC_API->newtransient)
-#define PyObjCObject_ReleaseTransient (PyObjC_API->releasetransient)
-#define PyObjC_PerformWeaklinking (PyObjC_API->doweaklink)
-#define PyObjCRT_RemoveFieldNames (PyObjC_API->removefields)
-#define PyObjC_NULL		  (*(PyObjC_API->pyobjc_null))
-#define PyObjC_DepythonifyCArray  (PyObjC_API->dep_c_array_count)
-#define PyObjC_VarList_New  (PyObjC_API->varlistnew)
-
-
-#ifndef PYOBJC_METHOD_STUB_IMPL
-
-static int
-PyObjC_ImportAPI(PyObject* calling_module)
-{
-	PyObject* m;
-	PyObject* d;
-	PyObject* api_obj;
-	PyObject* name = PyString_FromString("objc");
-	
-	m = PyImport_Import(name);
-	Py_DECREF(name);
-	if (m == NULL) {
-		return -1;
-	}
-
-	d = PyModule_GetDict(m);
-	if (d == NULL) {
-		PyErr_SetString(PyExc_RuntimeError, 
-			"No dict in objc module");
-		return -1;
-	}
-
-	api_obj = PyDict_GetItemString(d, PYOBJC_API_NAME);
-	if (api_obj == NULL) {
-		PyErr_SetString(PyExc_RuntimeError, 
-			"No C_API in objc module");
-		return -1;
-	}
-	PyObjC_API = PyCObject_AsVoidPtr(api_obj);
-	if (PyObjC_API == NULL) {
-		return 0;
-	}
-	if (PyObjC_API->api_version != PYOBJC_API_VERSION) {
-		PyErr_SetString(PyExc_RuntimeError,
-			"Wrong version of PyObjC C API");
-		return -1;
-	}
-	
-	if (PyObjC_API->struct_len < sizeof(struct pyobjc_api)) {
-		PyErr_SetString(PyExc_RuntimeError,
-			"Wrong struct-size of PyObjC C API");
-		return -1;
-	}
-
-	Py_INCREF(api_obj);
-
-	/* Current pyobjc implementation doesn't allow deregistering 
-	 * information, avoid unloading of users of the C-API.
-	 * (Yes this is ugle, patches to fix this situation are apriciated)
-	 */
-	Py_INCREF(calling_module);
-
-	return 0;
-}
-#endif /* PYOBJC_METHOD_STUB_IMPL */
-
-#else /* PyObjC_BUILD */
-
-extern struct pyobjc_api	objc_api;
-
-#endif /* !PYOBJC_BUILD */
-
-#endif /*  PyObjC_API_H */

pyobjc-framework-SystemConfiguration/PyObjCTest/test_DHCPClientPreferences.py

 
         r = DHCPClientPreferencesSetApplicationOptions( 
                 u"org.pyobjc.TestSuite", [9, 10, 0, 9], 4)
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r, count = DHCPClientPreferencesCopyApplicationOptions(u"com.apple.SystemPreferences", None)
-        self.failUnless(r is objc.NULL)
-        self.failUnless(count == 0)
+        self.assertTrue(r is objc.NULL)
+        self.assertTrue(count == 0)
 
 if __name__ == "__main__":
     main()

pyobjc-framework-SystemConfiguration/PyObjCTest/test_SCDynamicStore.py

 
 class TestSCDynamicStore (TestCase):
     def testTypes(self):
-        self.failUnless(isinstance(SCDynamicStoreRef, objc.objc_class))
+        self.assertTrue(isinstance(SCDynamicStoreRef, objc.objc_class))
 
     def testStructs(self):
-        self.failIf( hasattr(SystemConfiguration, 'SCDynamicStoreContext') )
+        self.assertFalse( hasattr(SystemConfiguration, 'SCDynamicStoreContext') )
 
     def testFunctions(self):
         n = SCDynamicStoreGetTypeID()
-        self.failUnless(isinstance(n, (int, long)))
+        self.assertTrue(isinstance(n, (int, long)))
 
 
         l = []
         st = SCDynamicStoreCreate(None, 
                 "pyobjc.test", 
                 callback, info)
-        self.failUnless(isinstance(st, SCDynamicStoreRef))
+        self.assertTrue(isinstance(st, SCDynamicStoreRef))
         
         st = SCDynamicStoreCreateWithOptions(None,
                 "pyobjc.test",
                 {},
                 callback,
                 info)
-        self.failUnless(isinstance(st, SCDynamicStoreRef))
+        self.assertTrue(isinstance(st, SCDynamicStoreRef))
 
 
         src = SCDynamicStoreCreateRunLoopSource(None, st, 0)
-        self.failUnless(isinstance(src, CFRunLoopSourceRef))
+        self.assertTrue(isinstance(src, CFRunLoopSourceRef))
         del src
 
         v = SCDynamicStoreCopyKeyList(st, u'.*')
-        self.failUnless(isinstance(v, CFArrayRef))
-        self.failUnless(len(v) > 0)
-        self.failUnless(isinstance(v[0], unicode))
+        self.assertTrue(isinstance(v, CFArrayRef))
+        self.assertTrue(len(v) > 0)
+        self.assertTrue(isinstance(v[0], unicode))
 
         r = SCDynamicStoreAddValue(st, "Setup:/PyObjC", { u"key":42 })
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCDynamicStoreAddTemporaryValue(st, "Setup:/PyObjC", { u"key":42 })
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         v = SCDynamicStoreCopyValue(st, "Setup:/")
-        self.failUnless(isinstance(v, CFDictionaryRef))
+        self.assertTrue(isinstance(v, CFDictionaryRef))
 
         v = SCDynamicStoreCopyMultiple(st, None, ['.*'])
-        self.failUnless(isinstance(v, CFDictionaryRef))
+        self.assertTrue(isinstance(v, CFDictionaryRef))
 
         r = SCDynamicStoreSetValue(st, "Setup:/PyObjC", { u"key":42 })
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCDynamicStoreSetMultiple(st, 
                 {
                 },
                 ['Setup:/PyObjC'],
                 ['System:/'])
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCDynamicStoreRemoveValue(st, "Setup:/PyObjC")
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCDynamicStoreNotifyValue(st, "Setup:/")
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCDynamicStoreSetNotificationKeys(st, ['Setup:/'], None)
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         r = SCDynamicStoreCopyNotifiedKeys(st)
-        self.failUnless(isinstance(r, CFArrayRef))
+        self.assertTrue(isinstance(r, CFArrayRef))
 
     def testCallbacks(self):
         if os.getuid() != 0:
 
         SCDynamicStoreSetNotificationKeys(st, None, ['.*'])
         src = SCDynamicStoreCreateRunLoopSource(None, st, 0)
-        self.failUnless(isinstance(src, CFRunLoopSourceRef))
+        self.assertTrue(isinstance(src, CFRunLoopSourceRef))
 
         SCDynamicStoreAddTemporaryValue(st, "pyobjc.test.key", "value")
 
         CFRunLoopAddSource(CFRunLoopGetCurrent(), src, kCFRunLoopCommonModes)
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 2.0, False)
 
-        self.failUnless(len(l) > 1)
-        self.failUnless(l[0][0] is st)
-        self.failUnlessIsInstance(l[0][1], CFArrayRef)
-        self.failUnless(l[0][2] is info)
+        self.assertTrue(len(l) > 1)
+        self.assertTrue(l[0][0] is st)
+        self.assertIsInstance(l[0][1], CFArrayRef)
+        self.assertTrue(l[0][2] is info)
         
 
 
 
 
     def testContants(self):
-        self.failUnless( isinstance(kSCDynamicStoreUseSessionKeys, unicode) )
+        self.assertTrue( isinstance(kSCDynamicStoreUseSessionKeys, unicode) )
 
 
 if __name__ == "__main__":

pyobjc-framework-SystemConfiguration/PyObjCTest/test_SCDynamicStoreCopyDHCPInfo.py

             pass
 
         st = SCDynamicStoreCreate(None, "pyobjc.test", callback, None)
-        self.failUnless(isinstance(st, SCDynamicStoreRef))
+        self.assertTrue(isinstance(st, SCDynamicStoreRef))
 
         info = SCDynamicStoreCopyDHCPInfo(st, None)
-        self.failUnless(isinstance(info, CFDictionaryRef))
+        self.assertTrue(isinstance(info, CFDictionaryRef))
 
         r = DHCPInfoGetOptionData(info,  1)
-        self.failUnless(r is None or isinstance(r, CFDataRef))
+        self.assertTrue(r is None or isinstance(r, CFDataRef))
 
         r = DHCPInfoGetLeaseStartTime(info)
-        self.failUnless(r is None or isinstance(r, CFDateRef))
+        self.assertTrue(r is None or isinstance(r, CFDateRef))
 
 if __name__ == "__main__":
     main()

pyobjc-framework-SystemConfiguration/PyObjCTest/test_SCDynamicStoreCopySpecific.py

             pass
 
         st = SCDynamicStoreCreate(None, "pyobjc.test", callback, None)
-        self.failUnless(isinstance(st, SCDynamicStoreRef))
+        self.assertTrue(isinstance(st, SCDynamicStoreRef))
 
         nm, encoding = SCDynamicStoreCopyComputerName(st, None)
-        self.failUnless(isinstance(nm, unicode))
-        self.failUnless(isinstance(encoding, (int, long)))
+        self.assertTrue(isinstance(nm, unicode))
+        self.assertTrue(isinstance(encoding, (int, long)))
 
         nm, uid, gid = SCDynamicStoreCopyConsoleUser(st, None, None)
-        self.failUnless(isinstance(nm, unicode))
-        self.failUnless(isinstance(uid, (int, long)))
-        self.failUnless(isinstance(gid, (int, long)))
+        self.assertTrue(isinstance(nm, unicode))
+        self.assertTrue(isinstance(uid, (int, long)))
+        self.assertTrue(isinstance(gid, (int, long)))
 
         nm = SCDynamicStoreCopyLocalHostName(st)
-        self.failUnless(isinstance(nm, unicode))
+        self.assertTrue(isinstance(nm, unicode))
 
         nm = SCDynamicStoreCopyLocation(st)
-        self.failUnless(isinstance(nm, unicode))
+        self.assertTrue(isinstance(nm, unicode))
 
         r = SCDynamicStoreCopyProxies(st)
-        self.failUnless(r is None or isinstance(r, CFDictionaryRef))
+        self.assertTrue(r is None or isinstance(r, CFDictionaryRef))
 
 
 if __name__ == "__main__":

pyobjc-framework-SystemConfiguration/PyObjCTest/test_SCDynamicStoreKey.py

 class TestSCDynamicStoreKey (TestCase):
     def testFunctions(self):
 
-        r = SCDynamicStoreKeyCreate(None, "Setup:/%s/%d", "PyObjC", 9)
-        self.failUnless(isinstance(r, unicode))
+        r = SCDynamicStoreKeyCreate(None, "Setup:/%s/%d", b"PyObjC", 9)
+        self.assertTrue(isinstance(r, unicode))
         self.assertEquals(r, u"Setup:/PyObjC/9")
 
         r = SCDynamicStoreKeyCreateNetworkGlobalEntity(None,
                 kSCDynamicStoreDomainSetup, kSCEntNetDNS)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateNetworkInterface(None, kSCDynamicStoreDomainState)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateNetworkInterfaceEntity(None,
                 kSCDynamicStoreDomainState, "en0", kSCEntNetIPv4)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateNetworkServiceEntity(None,
                 kSCDynamicStoreDomainState, "ssh", kSCEntNetDNS)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateComputerName(None)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateConsoleUser(None)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateHostNames(None)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateLocation(None)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCDynamicStoreKeyCreateProxies(None)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
 if __name__ == "__main__":
     main()

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scnetwork.py

     def testHardFunctions(self):
         b, flags = SCNetworkCheckReachabilityByAddress(
                 ('www.python.org', 80), objc._size_sockaddr_ip4, None)
-        self.failUnlessIsInstance(b, bool)
-        self.failUnlessIsInstance(flags, (int, long))
-        self.failUnlessEqual(b, True)
-        self.failUnlessEqual(flags, kSCNetworkFlagsReachable)
+        self.assertIsInstance(b, bool)
+        self.assertIsInstance(flags, (int, long))
+        self.assertEqual(b, True)
+        self.assertEqual(flags, kSCNetworkFlagsReachable)
 
 
     def testFunctions(self):
-        r, flags = SCNetworkCheckReachabilityByName("www.python.org", None)
-        self.failUnless(r is True or r is False)
-        self.failUnless(isinstance(flags, (int, long)))
+        r, flags = SCNetworkCheckReachabilityByName(b"www.python.org", None)
+        self.assertTrue(r is True or r is False)
+        self.assertTrue(isinstance(flags, (int, long)))
 
         r = SCNetworkInterfaceRefreshConfiguration("en0")
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
 
 if __name__ == "__main__":

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scnetworkconfiguration.py

 class TestSCNetworkConfiguration (TestCase):
 
     def testTypes(self):
-        self.failUnless(isinstance(SCNetworkInterfaceRef, objc.objc_class))
-        self.failUnless(isinstance(SCBondStatusRef, objc.objc_class))
-        self.failUnless(isinstance(SCNetworkProtocolRef, objc.objc_class))
-        self.failUnless(isinstance(SCNetworkServiceRef, objc.objc_class))
-        self.failUnless(isinstance(SCNetworkSetRef, objc.objc_class))
+        self.assertTrue(isinstance(SCNetworkInterfaceRef, objc.objc_class))
+        self.assertTrue(isinstance(SCBondStatusRef, objc.objc_class))
+        self.assertTrue(isinstance(SCNetworkProtocolRef, objc.objc_class))
+        self.assertTrue(isinstance(SCNetworkServiceRef, objc.objc_class))
+        self.assertTrue(isinstance(SCNetworkSetRef, objc.objc_class))
 
-        self.failUnless(SCBondInterfaceRef is SCNetworkInterfaceRef)
-        self.failUnless(SCVLANInterfaceRef is SCNetworkInterfaceRef)
+        self.assertTrue(SCBondInterfaceRef is SCNetworkInterfaceRef)
+        self.assertTrue(SCVLANInterfaceRef is SCNetworkInterfaceRef)
 
 
     def testConstants(self):
-        self.failUnless(isinstance(kSCNetworkInterfaceType6to4, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeBluetooth, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeBond, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeEthernet, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeFireWire, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeIEEE80211, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeL2TP, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeIrDA, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeModem, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypePPP, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypePPTP, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeSerial, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeVLAN, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeWWAN, unicode))
-        self.failUnless(isinstance(kSCNetworkInterfaceTypeIPv4, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceType6to4, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeBluetooth, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeBond, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeEthernet, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeFireWire, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeIEEE80211, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeL2TP, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeIrDA, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeModem, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypePPP, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypePPTP, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeSerial, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeVLAN, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeWWAN, unicode))
+        self.assertTrue(isinstance(kSCNetworkInterfaceTypeIPv4, unicode))
 
-        self.failUnless(isinstance(kSCNetworkInterfaceIPv4, SCNetworkInterfaceRef))
+        self.assertTrue(isinstance(kSCNetworkInterfaceIPv4, SCNetworkInterfaceRef))
 
         self.assertEquals(kSCBondStatusOK, 0)
         self.assertEquals(kSCBondStatusLinkInvalid, 1)
         self.assertEquals(kSCBondStatusNotInActiveGroup, 3)
         self.assertEquals(kSCBondStatusUnknown, 999)
 
-        self.failUnless(isinstance(kSCBondStatusDeviceAggregationStatus, unicode))
-        self.failUnless(isinstance(kSCBondStatusDeviceCollecting, unicode))
-        self.failUnless(isinstance(kSCBondStatusDeviceDistributing, unicode))
+        self.assertTrue(isinstance(kSCBondStatusDeviceAggregationStatus, unicode))
+        self.assertTrue(isinstance(kSCBondStatusDeviceCollecting, unicode))
+        self.assertTrue(isinstance(kSCBondStatusDeviceDistributing, unicode))
 
-        self.failUnless(isinstance(kSCNetworkProtocolTypeAppleTalk, unicode))
-        self.failUnless(isinstance(kSCNetworkProtocolTypeDNS, unicode))
-        self.failUnless(isinstance(kSCNetworkProtocolTypeIPv4, unicode))
-        self.failUnless(isinstance(kSCNetworkProtocolTypeIPv6, unicode))
-        self.failUnless(isinstance(kSCNetworkProtocolTypeProxies, unicode))
-        self.failUnless(isinstance(kSCNetworkProtocolTypeSMB, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeAppleTalk, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeDNS, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeIPv4, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeIPv6, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeProxies, unicode))
+        self.assertTrue(isinstance(kSCNetworkProtocolTypeSMB, unicode))
 
     def testFunctions(self):
 
         r = SCNetworkInterfaceGetTypeID()
-        self.failUnless(isinstance(r, (int, long)))
+        self.assertTrue(isinstance(r, (int, long)))
 
         r = SCNetworkInterfaceCopyAll()
-        self.failUnless(isinstance(r, CFArrayRef))
-        self.failUnless(len(r) > 0)
+        self.assertTrue(isinstance(r, CFArrayRef))
+        self.assertTrue(len(r) > 0)
 
         for iface in r:
             if SCNetworkInterfaceGetBSDName(iface).startswith('en'):
                 break
 
         r = SCNetworkInterfaceGetSupportedInterfaceTypes(iface)
-        self.failUnless(isinstance(r, CFArrayRef))
-        self.failUnless(isinstance(r[0], unicode))
+        self.assertTrue(isinstance(r, CFArrayRef))
+        self.assertTrue(isinstance(r[0], unicode))
 
         r = SCNetworkInterfaceGetSupportedProtocolTypes(iface)
-        self.failUnless(isinstance(r, CFArrayRef))
-        self.failUnless(isinstance(r[0], unicode))
+        self.assertTrue(isinstance(r, CFArrayRef))
+        self.assertTrue(isinstance(r[0], unicode))
 
         r = SCNetworkInterfaceCreateWithInterface(iface, kSCNetworkInterfaceTypeL2TP)
-        self.failUnless(r is None or isinstance(r, SCNetworkInterfaceRef))
+        self.assertTrue(r is None or isinstance(r, SCNetworkInterfaceRef))
 
         r = SCNetworkInterfaceGetBSDName(iface)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCNetworkInterfaceGetConfiguration(iface)
-        self.failUnless(r is None or isinstance(r, CFDictionaryRef))
+        self.assertTrue(r is None or isinstance(r, CFDictionaryRef))
 
         r = SCNetworkInterfaceGetExtendedConfiguration(iface, "EAPOL")
-        self.failUnless(r is None or isinstance(r, CFDictionaryRef))
+        self.assertTrue(r is None or isinstance(r, CFDictionaryRef))
 
         r = SCNetworkInterfaceGetHardwareAddressString(iface)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCNetworkInterfaceGetInterface(iface)
-        self.failUnless(r is None)
+        self.assertTrue(r is None)
 
         r = SCNetworkInterfaceGetInterfaceType(iface)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCNetworkInterfaceGetLocalizedDisplayName(iface)
-        self.failUnless(isinstance(r, unicode))
+        self.assertTrue(isinstance(r, unicode))
 
         r = SCNetworkInterfaceSetConfiguration(iface, {})
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCNetworkInterfaceSetExtendedConfiguration(iface, "OC", {})
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r, current, active, available = SCNetworkInterfaceCopyMediaOptions(iface,
                 None, None, None, False)
-        self.failUnless(r is True)
-        self.failUnless(isinstance(current, CFDictionaryRef))
-        self.failUnless(isinstance(active, CFDictionaryRef))
-        self.failUnless(isinstance(available, CFArrayRef))
+        self.assertTrue(r is True)
+        self.assertTrue(isinstance(current, CFDictionaryRef))
+        self.assertTrue(isinstance(active, CFDictionaryRef))
+        self.assertTrue(isinstance(available, CFArrayRef))
 
         r = SCNetworkInterfaceCopyMediaSubTypes(available)
-        self.failUnless(isinstance(r, CFArrayRef))
+        self.assertTrue(isinstance(r, CFArrayRef))
         for item in r:
-            self.failUnless(isinstance(item, unicode))
+            self.assertTrue(isinstance(item, unicode))
 
         r = SCNetworkInterfaceCopyMediaSubTypeOptions(available, r[1])
-        self.failUnless(isinstance(r, CFArrayRef))
+        self.assertTrue(isinstance(r, CFArrayRef))
 
         r, mtu_cur, mtu_min, mtu_max = SCNetworkInterfaceCopyMTU(iface, None, None, None)
-        self.failUnless(r is True)
-        self.failUnless(isinstance(mtu_cur, (int, long)))
-        self.failUnless(isinstance(mtu_min, (int, long)))
-        self.failUnless(isinstance(mtu_max, (int, long)))
+        self.assertTrue(r is True)
+        self.assertTrue(isinstance(mtu_cur, (int, long)))
+        self.assertTrue(isinstance(mtu_min, (int, long)))
+        self.assertTrue(isinstance(mtu_max, (int, long)))
 
         r = SCNetworkInterfaceSetMediaOptions(iface,
                 current['MediaSubType'],
                 current['MediaOptions'])
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCNetworkInterfaceSetMTU(iface, mtu_cur)
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         r = SCNetworkInterfaceForceConfigurationRefresh(iface)
-        self.failUnless(r is True or r is False)
+        self.assertTrue(r is True or r is False)
 
         prefs = SCPreferencesCreate(None, "SystemConfiguration", None)
-        self.failUnless(isinstance(prefs, SCPreferencesRef))
+        self.assertTrue(isinstance(prefs, SCPreferencesRef))
 
         a = SCBondInterfaceCopyAll(prefs)
-        self.failUnless(isinstance(a, CFArrayRef))
+        self.assertTrue(isinstance(a, CFArrayRef))
 
         a = SCBondInterfaceCopyAvailableMemberInterfaces(prefs)
-        self.failUnless(isinstance(a, CFArrayRef))
+        self.assertTrue(isinstance(a, CFArrayRef))
 
         iface = SCBondInterfaceCreate(prefs)
-        self.failUnless(iface is None or isinstance(iface, SCBondInterfaceRef))
+        self.assertTrue(iface is None or isinstance(iface, SCBondInterfaceRef))
 
         if iface is not None:
             a = SCBondInterfaceGetMemberInterfaces(iface)
-            self.failUnless(isinstance(a, CFArrayRef))
+            self.assertTrue(isinstance(a, CFArrayRef))
 
             o = SCBondInterfaceGetOptions(iface)
-            self.failUnless(o is None or isinstance(o, CFDictionaryRef))
+            self.assertTrue(o is None or isinstance(o, CFDictionaryRef))
 
             r = SCBondInterfaceSetMemberInterfaces(iface, SCNetworkInterfaceCopyAll())
-            self.failUnless(r is True or r is False)
+            self.assertTrue(r is True or r is False)
 
             r = SCBondInterfaceSetLocalizedDisplayName(iface, "pyobjc.bond")
-            self.failUnless(r is True or r is False)
+            self.assertTrue(r is True or r is False)
            
 
             r = SCBondInterfaceSetOptions(iface, {})
-            self.failUnless(r is True or r is False)
+            self.assertTrue(r is True or r is False)
 
             st = SCBondInterfaceCopyStatus(iface)
-            self.failUnless(st is None or isinstance(st, SCBondStatusRef))
+            self.assertTrue(st is None or isinstance(st, SCBondStatusRef))
 
             a = SCBondStatusGetMemberInterfaces(iface)
-            self.failUnless(a is None or isinstance(a, CFArrayRef))
+            self.assertTrue(a is None or isinstance(a, CFArrayRef))
 
             st = SCBondStatusGetInterfaceStatus(iface, None)
-            self.failUnless(a is None or isinstance(a, CFDictionaryRef))
+            self.assertTrue(a is None or isinstance(a, CFDictionaryRef))
 
             r = SCBondInterfaceRemove(iface)
-            self.failUnless(r is True)
+            self.assertTrue(r is True)
 
         r = SCBondStatusGetTypeID()
-        self.failUnless(isinstance(r, (int, long)))
+        self.assertTrue(isinstance(r, (int, long)))
 
         a = SCVLANInterfaceCopyAll(prefs)
-        self.failUnless(isinstance(a, CFArrayRef))
+        self.assertTrue(isinstance(a, CFArrayRef))
 
         a = SCVLANInterfaceCopyAvailablePhysicalInterfaces()
-        self.failUnless(isinstance(a, CFArrayRef))
+        self.assertTrue(isinstance(a, CFArrayRef))
 
         iface = SCVLANInterfaceCreate(prefs, a[0], 99)
-        self.failUnless(isinstance(iface, SCVLANInterfaceRef))
+        self.assertTrue(isinstance(iface, SCVLANInterfaceRef))
 
         r = SCVLANInterfaceGetPhysicalInterface(iface)
-        self.failUnless(r is a[0])
+        self.assertTrue(r is a[0])
 
         t = SCVLANInterfaceGetTag(iface)
         self.assertEquals(t, 99)
 
         t = SCVLANInterfaceGetOptions(iface)
-        self.failUnless(t is None or isinstance(t, CFDictionaryRef))
+        self.assertTrue(t is None or isinstance(t, CFDictionaryRef))
 
         r = SCVLANInterfaceSetPhysicalInterfaceAndTag(iface, a[0], 42)
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         r = SCVLANInterfaceSetLocalizedDisplayName(iface, "octest")
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         r = SCVLANInterfaceSetOptions(iface, {"name": "foo"})
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         t = SCVLANInterfaceGetOptions(iface)
-        self.failUnless(isinstance(t, CFDictionaryRef))
+        self.assertTrue(isinstance(t, CFDictionaryRef))
 
         r = SCVLANInterfaceRemove(iface)
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         r = SCNetworkProtocolGetTypeID()
-        self.failUnless(isinstance(r, (int, long)))
+        self.assertTrue(isinstance(r, (int, long)))
 
         r = SCNetworkServiceGetTypeID()
-        self.failUnless(isinstance(r, (int, long)))
+        self.assertTrue(isinstance(r, (int, long)))
 
         r = SCNetworkSetGetTypeID()
-        self.failUnless(isinstance(r, (int, long)))
+        self.assertTrue(isinstance(r, (int, long)))
 
         r = SCNetworkServiceCopyAll(prefs)
-        self.failUnlessIsInstance(r, CFArrayRef)
+        self.assertIsInstance(r, CFArrayRef)
 
         serv = r[0]
-        self.failUnlessIsInstance(serv, SCNetworkServiceRef)
+        self.assertIsInstance(serv, SCNetworkServiceRef)
         prot = SCNetworkServiceCopyProtocol(serv, kSCNetworkProtocolTypeIPv4)
-        self.failUnlessIsInstance(prot, SCNetworkProtocolRef)
+        self.assertIsInstance(prot, SCNetworkProtocolRef)
 
         conf = SCNetworkProtocolGetConfiguration(prot)
-        self.failUnlessIsInstance(conf, CFDictionaryRef)
+        self.assertIsInstance(conf, CFDictionaryRef)
 
         enabled = SCNetworkProtocolGetEnabled(prot)
-        self.failUnlessIsInstance(enabled, bool)
+        self.assertIsInstance(enabled, bool)
 
         pr = SCNetworkProtocolGetProtocolType(prot)
-        self.failUnlessIsInstance(pr, unicode)
+        self.assertIsInstance(pr, unicode)
 
         v = SCNetworkProtocolSetConfiguration(prot, conf)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkProtocolSetEnabled(prot, enabled)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkServiceAddProtocolType(serv, pr)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
 
         v = SCNetworkServiceCopyProtocols(serv)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertIsInstance(v, CFArrayRef)
         if v:
-            self.failUnlessIsInstance(v[0], SCNetworkProtocolRef)
+            self.assertIsInstance(v[0], SCNetworkProtocolRef)
 
 
         iface = SCNetworkServiceGetInterface(serv)
-        self.failUnlessIsInstance(iface, SCNetworkInterfaceRef)
+        self.assertIsInstance(iface, SCNetworkInterfaceRef)
 
         v = SCNetworkServiceCreate(prefs, iface)
-        self.failUnlessIsInstance(v, SCNetworkServiceRef)
+        self.assertIsInstance(v, SCNetworkServiceRef)
 
         v = s2 = SCNetworkServiceCopy(prefs, SCNetworkServiceGetServiceID(serv))
-        self.failUnlessIsInstance(v, SCNetworkServiceRef)
+        self.assertIsInstance(v, SCNetworkServiceRef)
 
         v = SCNetworkServiceGetEnabled(serv)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkServiceGetName(serv)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
-        self.failUnlessResultIsCFRetained(SCNetworkServiceCopyProtocol)
+        self.assertResultIsCFRetained(SCNetworkServiceCopyProtocol)
 
         v = SCNetworkServiceRemoveProtocolType(s2, kSCNetworkProtocolTypeIPv4)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkServiceRemove(s2)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkServiceSetEnabled(serv, SCNetworkServiceGetEnabled(serv))
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkServiceSetName(serv, SCNetworkServiceGetName(serv))
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         set = SCNetworkSetCopyCurrent(prefs)
-        self.failUnlessIsInstance(set, SCNetworkSetRef)
+        self.assertIsInstance(set, SCNetworkSetRef)
 
         s2 = SCNetworkServiceCopy(prefs, SCNetworkServiceGetServiceID(serv))
 
         v = SCNetworkSetAddService(set,  s2)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
 
         v  = SCNetworkSetContainsInterface(set, iface)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkSetCopyAll(prefs)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertIsInstance(v, CFArrayRef)
 
         v = SCNetworkSetCopyServices(set)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertIsInstance(v, CFArrayRef)
 
         v = SCNetworkSetCreate(prefs)
-        self.failUnlessIsInstance(v, SCNetworkSetRef)
+        self.assertIsInstance(v, SCNetworkSetRef)
 
         v = SCNetworkSetCopy(prefs, SCNetworkSetGetSetID(set))
-        self.failUnlessIsInstance(v, SCNetworkSetRef)
+        self.assertIsInstance(v, SCNetworkSetRef)
 
         v = SCNetworkSetRemove(v)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkSetGetName(set)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
         v = SCNetworkSetGetSetID(set)
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
         v = SCNetworkSetGetServiceOrder(set)
-        self.failUnlessIsInstance(v, CFArrayRef)
+        self.assertIsInstance(v, CFArrayRef)
 
         v = SCNetworkSetSetName(set, SCNetworkSetGetName(set))
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkSetSetServiceOrder(set, SCNetworkSetGetServiceOrder(set))
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         v = SCNetworkSetSetCurrent(SCNetworkSetCopyCurrent(prefs))
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
 
     @min_os_level('10.5')
     def testFunctions10_5(self):
         prefs = SCPreferencesCreate(None, "SystemConfiguration", None)
-        self.failUnless(isinstance(prefs, SCPreferencesRef))
+        self.assertTrue(isinstance(prefs, SCPreferencesRef))
 
         r = SCNetworkServiceCopyAll(prefs)
-        self.failUnlessIsInstance(r, CFArrayRef)
+        self.assertIsInstance(r, CFArrayRef)
         serv = SCNetworkServiceCopy(prefs, SCNetworkServiceGetServiceID(r[0]))
 
         v = SCNetworkServiceEstablishDefaultConfiguration(serv)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         
 

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scnetworkconnection.py

 
 class TestSCNetworkConnection (TestCase):
     def testTypes(self):
-        self.failUnlessIsInstance(SCNetworkConnectionRef, objc.objc_class)
+        self.assertIsInstance(SCNetworkConnectionRef, objc.objc_class)
 
     def testConstants(self):
-        self.failUnlessEqual(kSCNetworkConnectionInvalid,  -1)
-        self.failUnlessEqual(kSCNetworkConnectionDisconnected,  0)
-        self.failUnlessEqual(kSCNetworkConnectionConnecting,  1)
-        self.failUnlessEqual(kSCNetworkConnectionConnected,  2)
-        self.failUnlessEqual(kSCNetworkConnectionDisconnecting,  3)
+        self.assertEqual(kSCNetworkConnectionInvalid,  -1)
+        self.assertEqual(kSCNetworkConnectionDisconnected,  0)
+        self.assertEqual(kSCNetworkConnectionConnecting,  1)
+        self.assertEqual(kSCNetworkConnectionConnected,  2)
+        self.assertEqual(kSCNetworkConnectionDisconnecting,  3)
 
-        self.failUnlessEqual(kSCNetworkConnectionPPPDisconnected,  0)
-        self.failUnlessEqual(kSCNetworkConnectionPPPInitializing,  1)
-        self.failUnlessEqual(kSCNetworkConnectionPPPConnectingLink,  2)
-        self.failUnlessEqual(kSCNetworkConnectionPPPDialOnTraffic,  3)
-        self.failUnlessEqual(kSCNetworkConnectionPPPNegotiatingLink,  4)
-        self.failUnlessEqual(kSCNetworkConnectionPPPAuthenticating,  5)
-        self.failUnlessEqual(kSCNetworkConnectionPPPWaitingForCallBack,  6)
-        self.failUnlessEqual(kSCNetworkConnectionPPPNegotiatingNetwork,  7)
-        self.failUnlessEqual(kSCNetworkConnectionPPPConnected,  8)
-        self.failUnlessEqual(kSCNetworkConnectionPPPTerminating,  9)
-        self.failUnlessEqual(kSCNetworkConnectionPPPDisconnectingLink,  10)
-        self.failUnlessEqual(kSCNetworkConnectionPPPHoldingLinkOff,  11)
-        self.failUnlessEqual(kSCNetworkConnectionPPPSuspended,  12)
-        self.failUnlessEqual(kSCNetworkConnectionPPPWaitingForRedial,  13)
+        self.assertEqual(kSCNetworkConnectionPPPDisconnected,  0)
+        self.assertEqual(kSCNetworkConnectionPPPInitializing,  1)
+        self.assertEqual(kSCNetworkConnectionPPPConnectingLink,  2)
+        self.assertEqual(kSCNetworkConnectionPPPDialOnTraffic,  3)
+        self.assertEqual(kSCNetworkConnectionPPPNegotiatingLink,  4)
+        self.assertEqual(kSCNetworkConnectionPPPAuthenticating,  5)
+        self.assertEqual(kSCNetworkConnectionPPPWaitingForCallBack,  6)
+        self.assertEqual(kSCNetworkConnectionPPPNegotiatingNetwork,  7)
+        self.assertEqual(kSCNetworkConnectionPPPConnected,  8)
+        self.assertEqual(kSCNetworkConnectionPPPTerminating,  9)
+        self.assertEqual(kSCNetworkConnectionPPPDisconnectingLink,  10)
+        self.assertEqual(kSCNetworkConnectionPPPHoldingLinkOff,  11)
+        self.assertEqual(kSCNetworkConnectionPPPSuspended,  12)
+        self.assertEqual(kSCNetworkConnectionPPPWaitingForRedial,  13)
 
-        self.failUnlessEqual(kSCNetworkConnectionBytesIn, u"BytesIn")
-        self.failUnlessEqual(kSCNetworkConnectionBytesOut, u"BytesOut")
-        self.failUnlessEqual(kSCNetworkConnectionPacketsIn, u"PacketsIn")
-        self.failUnlessEqual(kSCNetworkConnectionPacketsOut, u"PacketsOut")
-        self.failUnlessEqual(kSCNetworkConnectionErrorsIn, u"ErrorsIn")
-        self.failUnlessEqual(kSCNetworkConnectionErrorsOut, u"ErrorsOut")
+        self.assertEqual(kSCNetworkConnectionBytesIn, u"BytesIn")
+        self.assertEqual(kSCNetworkConnectionBytesOut, u"BytesOut")
+        self.assertEqual(kSCNetworkConnectionPacketsIn, u"PacketsIn")
+        self.assertEqual(kSCNetworkConnectionPacketsOut, u"PacketsOut")
+        self.assertEqual(kSCNetworkConnectionErrorsIn, u"ErrorsIn")
+        self.assertEqual(kSCNetworkConnectionErrorsOut, u"ErrorsOut")
 
     def testFunctions(self):
         v = SCNetworkConnectionGetTypeID()
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
-        self.failUnlessResultIsBOOL(SCNetworkConnectionCopyUserPreferences)
-        self.failUnlessArgIsOut(SCNetworkConnectionCopyUserPreferences, 1)
-        self.failUnlessArgIsOut(SCNetworkConnectionCopyUserPreferences, 2)
+        self.assertResultIsBOOL(SCNetworkConnectionCopyUserPreferences)
+        self.assertArgIsOut(SCNetworkConnectionCopyUserPreferences, 1)
+        self.assertArgIsOut(SCNetworkConnectionCopyUserPreferences, 2)
         v,  servId, userOpts = SCNetworkConnectionCopyUserPreferences(None, None, None)
         if v:
-            self.failUnlessIsInstance(servId, unicode)
-            self.failUnlessIsInstance(userOpts, CFDictionaryRef)
+            self.assertIsInstance(servId, unicode)
+            self.assertIsInstance(userOpts, CFDictionaryRef)
         else:
-            self.failUnless(servId is None)
-            self.failUnless(userOpts is None)
+            self.assertTrue(servId is None)
+            self.assertTrue(userOpts is None)
 
         def callout(ref, status, info):
             pass
         ctx = object()
         v = SCNetworkConnectionCreateWithServiceID(None, "pyobjc.test.id", callout, ctx)
 
-        self.failUnlessResultIsCFRetained(SCNetworkConnectionCopyServiceID)
+        self.assertResultIsCFRetained(SCNetworkConnectionCopyServiceID)
 
         # FIXME: Need test for this
         SCNetworkConnectionGetStatus
 
-        self.failUnlessResultIsCFRetained(SCNetworkConnectionCopyExtendedStatus)
-        self.failUnlessResultIsCFRetained(SCNetworkConnectionCopyStatistics)
-        self.failUnlessResultIsBOOL(SCNetworkConnectionStart)
-        self.failUnlessResultIsBOOL(SCNetworkConnectionStop)
-        self.failUnlessResultIsCFRetained(SCNetworkConnectionCopyUserOptions)
-        self.failUnlessResultIsBOOL(SCNetworkConnectionScheduleWithRunLoop)
-        self.failUnlessResultIsBOOL(SCNetworkConnectionUnscheduleFromRunLoop)
+        self.assertResultIsCFRetained(SCNetworkConnectionCopyExtendedStatus)
+        self.assertResultIsCFRetained(SCNetworkConnectionCopyStatistics)
+        self.assertResultIsBOOL(SCNetworkConnectionStart)
+        self.assertResultIsBOOL(SCNetworkConnectionStop)
+        self.assertResultIsCFRetained(SCNetworkConnectionCopyUserOptions)
+        self.assertResultIsBOOL(SCNetworkConnectionScheduleWithRunLoop)
+        self.assertResultIsBOOL(SCNetworkConnectionUnscheduleFromRunLoop)
 
 
 if __name__ == "__main__":

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scnetworkreachability.py

 
 class TestSCNetworkReachability (TestCase):
     def testTypes(self):
-        self.failUnlessIsInstance(SCNetworkReachabilityRef, objc.objc_class)
+        self.assertIsInstance(SCNetworkReachabilityRef, objc.objc_class)
 
     def testFunctions(self):
-        self.failUnlessResultIsCFRetained(SCNetworkReachabilityCreateWithAddressPair)
+        self.assertResultIsCFRetained(SCNetworkReachabilityCreateWithAddressPair)
         v = SCNetworkReachabilityCreateWithAddressPair(None, 
                 ('0.0.0.0', 20990),
                 ('www.python.org', 80))
         sd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         sd.listen(5)
 
-        self.failUnlessResultIsCFRetained(SCNetworkReachabilityCreateWithAddress)
+        self.assertResultIsCFRetained(SCNetworkReachabilityCreateWithAddress)
         ref = v = SCNetworkReachabilityCreateWithAddress(None, sd.getsockname())
-        self.failUnlessIsInstance(v, SCNetworkReachabilityRef)
+        self.assertIsInstance(v, SCNetworkReachabilityRef)
 
-        self.failUnlessResultIsCFRetained(SCNetworkReachabilityCreateWithName)
-        v = SCNetworkReachabilityCreateWithName(None, 'www.python.org')
-        self.failUnlessIsInstance(v, SCNetworkReachabilityRef)
+        self.assertResultIsCFRetained(SCNetworkReachabilityCreateWithName)
+        v = SCNetworkReachabilityCreateWithName(None, b'www.python.org')
+        self.assertIsInstance(v, SCNetworkReachabilityRef)
 
         v = SCNetworkReachabilityGetTypeID()
-        self.failUnlessIsInstance(v, (int, long))
+        self.assertIsInstance(v, (int, long))
 
-        self.failUnlessResultIsBOOL(SCNetworkReachabilityGetFlags)
+        self.assertResultIsBOOL(SCNetworkReachabilityGetFlags)
         v, fl = SCNetworkReachabilityGetFlags(ref, None)
-        self.failUnless(v)
-        self.failUnlessIsInstance(fl, (int, long))
+        self.assertTrue(v)
+        self.assertIsInstance(fl, (int, long))
 
 
         l = []
             print flags
         ctx = object()
         v = SCNetworkReachabilitySetCallback(ref, callout, ctx)
-        self.failUnless(v is True)
+        self.assertTrue(v is True)
 
 
         rl = CFRunLoopGetCurrent()
-        self.failUnlessResultIsBOOL(SCNetworkReachabilityScheduleWithRunLoop)
+        self.assertResultIsBOOL(SCNetworkReachabilityScheduleWithRunLoop)
         r = SCNetworkReachabilityScheduleWithRunLoop(ref, rl, kCFRunLoopCommonModes)
 
         sd.close()
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, False)
 
-        self.failUnlessResultIsBOOL(SCNetworkReachabilityUnscheduleFromRunLoop)
+        self.assertResultIsBOOL(SCNetworkReachabilityUnscheduleFromRunLoop)
         r = SCNetworkReachabilityUnscheduleFromRunLoop(ref, rl, kCFRunLoopCommonModes)
 
         

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scpreferences.py

 
 class TestSCPreferences (TestCase):
     def testConstants(self):
-        self.failUnlessEqual(kSCPreferencesNotificationCommit, 1<<0)
-        self.failUnlessEqual(kSCPreferencesNotificationApply, 1<<1)
+        self.assertEqual(kSCPreferencesNotificationCommit, 1<<0)
+        self.assertEqual(kSCPreferencesNotificationApply, 1<<1)
 
     def testFunctions(self):
-        self.failUnlessIsInstance(SCPreferencesGetTypeID(), (int, long))
+        self.assertIsInstance(SCPreferencesGetTypeID(), (int, long))
 
         ref = SCPreferencesCreate(None, "pyobjc.test", "pyobjc.test")
-        self.failUnlessIsInstance(ref, SCPreferencesRef)
+        self.assertIsInstance(ref, SCPreferencesRef)
 
-        self.failUnlessResultIsBOOL(SCPreferencesLock)
-        self.failUnlessArgIsBOOL(SCPreferencesLock, 1)
+        self.assertResultIsBOOL(SCPreferencesLock)
+        self.assertArgIsBOOL(SCPreferencesLock, 1)
         v = SCPreferencesLock(ref, False)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
-        self.failUnlessResultIsBOOL(SCPreferencesUnlock)
+        self.assertResultIsBOOL(SCPreferencesUnlock)
         v = SCPreferencesUnlock(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
-        self.failUnlessResultIsBOOL(SCPreferencesCommitChanges)
+        self.assertResultIsBOOL(SCPreferencesCommitChanges)
         v = SCPreferencesCommitChanges(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
-        self.failUnlessResultIsBOOL(SCPreferencesApplyChanges)
+        self.assertResultIsBOOL(SCPreferencesApplyChanges)
         v = SCPreferencesApplyChanges(ref)
-        self.failUnlessIsInstance(v, bool)
+        self.assertIsInstance(v, bool)
 
         r = SCPreferencesGetSignature(ref)
-        self.failUnlessIsInstance(r, CFDataRef)
+        self.assertIsInstance(r, CFDataRef)
 
         r = SCPreferencesCopyKeyList(ref)
-        self.failUnlessIsInstance(r, CFArrayRef)
+        self.assertIsInstance(r, CFArrayRef)
 
         l = []
         def callback(ref, key, ctx):
         ctx = object()
 
         v = SCPreferencesSetCallback(ref, callback, ctx)
-        self.failUnless(v is True)
+        self.assertTrue(v is True)
 
-        self.failUnlessResultIsBOOL(SCPreferencesAddValue)
+        self.assertResultIsBOOL(SCPreferencesAddValue)
         r = SCPreferencesAddValue(ref, "use_python3", False)
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
         v = SCPreferencesGetValue(ref, "use_python3")
-        self.failUnless(v is False)
+        self.assertTrue(v is False)
 
         v = SCPreferencesGetValue(ref, "use_python4")
-        self.failUnless(v is None)
+        self.assertTrue(v is None)
 
-        self.failUnlessResultIsBOOL(SCPreferencesSetValue)
+        self.assertResultIsBOOL(SCPreferencesSetValue)
         r = SCPreferencesSetValue(ref, "use_python3", "on newyearsday")
-        self.failUnless(r is True)
+        self.assertTrue(r is True)
 
-        self.failUnlessResultIsBOOL(SCPreferencesRemoveValue)
+        self.assertResultIsBOOL(SCPreferencesRemoveValue)
         r = SCPreferencesRemoveValue(ref, "use_python3")
 
-        self.failUnlessResultIsBOOL(SCPreferencesScheduleWithRunLoop)
+        self.assertResultIsBOOL(SCPreferencesScheduleWithRunLoop)
         rl = CFRunLoopGetCurrent()
         r = SCPreferencesScheduleWithRunLoop(ref, rl, kCFRunLoopCommonModes)
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, False)
 
-        self.failUnlessResultIsBOOL(SCPreferencesUnscheduleFromRunLoop)
+        self.assertResultIsBOOL(SCPreferencesUnscheduleFromRunLoop)
         r = SCPreferencesUnscheduleFromRunLoop(ref, rl, kCFRunLoopCommonModes)
 
 
         # XXX: Security frameworks aren't wrapped yet
         aref = None
         ref = SCPreferencesCreateWithAuthorization(None, "pyobjc.test", "pyobjc.test", aref)
-        self.failUnlessIsInstance(ref, SCPreferencesRef)
+        self.assertIsInstance(ref, SCPreferencesRef)
 
 
 

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scpreferencespath.py

 
     def testFunctions(self):
         ref = SCPreferencesCreate(None, "pyobjc.test", "pyobjc.test")
-        self.failUnlessIsInstance(ref, SCPreferencesRef)
+        self.assertIsInstance(ref, SCPreferencesRef)
 
         r = SCPreferencesAddValue(ref, "use", 
                 NSMutableDictionary.dictionaryWithDictionary_(
                     { "python2": True, "python3": False }))
-        self.failUnless(r)
+        self.assertTrue(r)
 
         v = SCPreferencesPathCreateUniqueChild(ref, "/")
-        self.failUnlessIsInstance(v, unicode)
+        self.assertIsInstance(v, unicode)
 
         v = SCPreferencesPathGetValue(ref, "/use")
-        self.failUnlessIsInstance(v, CFDictionaryRef)
+        self.assertIsInstance(v, CFDictionaryRef)
 
         v = SCPreferencesPathSetValue(ref, "/use", dict(python2=True, python3=True))
-        self.failUnless(v is True)
+        self.assertTrue(v is True)
 
         v = SCPreferencesPathSetLink(ref, "/use_python", "/use")
-        self.failUnless(v is True)
+        self.assertTrue(v is True)
 
         v = SCPreferencesPathGetLink(ref, "/use_python")
-        self.failUnlessEqual(v, "/use")
+        self.assertEqual(v, "/use")
 
         v = SCPreferencesPathRemoveValue(ref, "/use")
-        self.failUnless(v is True)
+        self.assertTrue(v is True)
 
 if __name__ == "__main__":
     main()

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scpreferencessetspecific.py

 class TestSCPreferencesSetSpecific (TestCase):
     def testFunctions(self):
         ref = SCPreferencesCreate(None, "pyobjc.test", "pyobjc.test")
-        self.failUnlessIsInstance(ref, SCPreferencesRef)
+        self.assertIsInstance(ref, SCPreferencesRef)
 
         v = SCPreferencesSetComputerName(ref, "my host", kCFStringEncodingUTF8)
-        self.failUnless(isinstance(v, bool))
+        self.assertTrue(isinstance(v, bool))
 
         v = SCPreferencesSetLocalHostName(ref, "my.host.private")
-        self.failUnless(isinstance(v, bool))
+        self.assertTrue(isinstance(v, bool))
 
         # NOTE: Do not commit changes, that would mess with the computer running
         # the tests

pyobjc-framework-SystemConfiguration/PyObjCTest/test_scschemadefinitions.py

 class TestSCSchemaDefinitions (TestCase):
     @min_os_level('10.5')
     def testConstants10_5(self):
-        self.failUnlessIsInstance(kSCEntNetIPSec, unicode)
-        self.failUnlessIsInstance(kSCEntNetSMB, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecLocalIdentifier, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecLocalIdentifierType, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecAuthenticationMethod, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecSharedSecret, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecSharedSecretEncryption, unicode)
-        self.failUnlessIsInstance(kSCPropNetIPSecLocalCertificate, unicode)
-        self.failUnlessIsInstance(kSCValNetIPSecAuthenticationMethodSharedSecret, unicode)
-        self.failUnlessIsInstance(kSCValNetIPSecAuthenticationMethodCertificate, unicode)
-        self.failUnlessIsInstance(kSCValNetIPSecSharedSecretEncryptionKeychain, unicode)
-        self.failUnlessIsInstance(kSCValNetIPSecLocalIdentifierTypeKeyID, unicode)
-        self.failUnlessIsInstance(kSCPropNetModemAccessPointName, unicode)
-        self.failUnlessIsInstance(kSCPropNetModemConnectionPersonality, unicode)
-        self.failUnlessIsInstance(kSCPropNetModemDeviceContextID, unicode)
-        self.failUnlessIsInstance(kSCPropNetModemDeviceModel, unicode)
-        self.failUnlessIsInstance(kSCPropNetModemDeviceVendor, unicode)
-        self.failUnlessIsInstance(kSCValNetPPPAuthPasswordEncryptionToken, unicode)
-        self.failUnlessIsInstance(kSCPropNetSMBNetBIOSName, unicode)
-        self.failUnlessIsInstance(kSCPropNetSMBNetBIOSNodeType, unicode)
-        self.failUnlessIsInstance(kSCPropNetSMBNetBIOSScope, unicode)
-        self.failUnlessIsInstance(kSCPropNetSMBWINSAddresses, unicode)
-        self.failUnlessIsInstance(kSCPropNetSMBWorkgroup, unicode)
-        self.failUnlessIsInstance(kSCValNetSMBNetBIOSNodeTypeBroadcast, unicode)
-        self.failUnlessIsInstance(kSCValNetSMBNetBIOSNodeTypePeer, unicode)
-        self.failUnlessIsInstance(kSCValNetSMBNetBIOSNodeTypeMixed, unicode)
-        self.failUnlessIsInstance(kSCValNetSMBNetBIOSNodeTypeHybrid, unicode)
+        self.assertIsInstance(kSCEntNetIPSec, unicode)
+        self.assertIsInstance(kSCEntNetSMB, unicode)
+        self.assertIsInstance(kSCPropNetIPSecLocalIdentifier, unicode)
+        self.assertIsInstance(kSCPropNetIPSecLocalIdentifierType, unicode)
+        self.assertIsInstance(kSCPropNetIPSecAuthenticationMethod, unicode)
+        self.assertIsInstance(kSCPropNetIPSecSharedSecret, unicode)
+        self.assertIsInstance(kSCPropNetIPSecSharedSecretEncryption, unicode)
+        self.assertIsInstance(kSCPropNetIPSecLocalCertificate, unicode)
+        self.assertIsInstance(kSCValNetIPSecAuthenticationMethodSharedSecret, unicode)
+        self.assertIsInstance(kSCValNetIPSecAuthenticationMethodCertificate, unicode)
+        self.assertIsInstance(kSCValNetIPSecSharedSecretEncryptionKeychain, unicode)
+        self.assertIsInstance(kSCValNetIPSecLocalIdentifierTypeKeyID, unicode)
+        self.assertIsInstance(kSCPropNetModemAccessPointName, unicode)
+        self.assertIsInstance(kSCPropNetModemConnectionPersonality, unicode)
+        self.assertIsInstance(kSCPropNetModemDeviceContextID, unicode)
+        self.assertIsInstance(kSCPropNetModemDeviceModel, unicode)
+        self.assertIsInstance(kSCPropNetModemDeviceVendor, unicode)
+        self.assertIsInstance(kSCValNetPPPAuthPasswordEncryptionToken, unicode)
+        self.assertIsInstance(kSCPropNetSMBNetBIOSName, unicode)
+        self.assertIsInstance(kSCPropNetSMBNetBIOSNodeType, unicode)
+        self.assertIsInstance(kSCPropNetSMBNetBIOSScope, unicode)
+        self.assertIsInstance(kSCPropNetSMBWINSAddresses, unicode)
+        self.assertIsInstance(kSCPropNetSMBWorkgroup, unicode)
+        self.assertIsInstance(kSCValNetSMBNetBIOSNodeTypeBroadcast, unicode)
+        self.assertIsInstance(kSCValNetSMBNetBIOSNodeTypePeer, unicode)
+        self.assertIsInstance(kSCValNetSMBNetBIOSNodeTypeMixed, unicode)
+        self.assertIsInstance(kSCValNetSMBNetBIOSNodeTypeHybrid, unicode)
 
     def testConstants(self):
-        self.failUnlessIsInstance(kSCResvLink, unicode)
-        self.failUnlessIsInstance(kSCResvInactive, unicode)
-        self.failUnlessIsInstance(kSCPropInterfaceName, unicode)
-        self.failUnlessIsInstance(kSCPropMACAddress, unicode)
-        self.failUnlessIsInstance(kSCPropUserDefinedName, unicode)
-        self.failUnlessIsInstance(kSCPropVersion, unicode)
-        self.failUnlessIsInstance(kSCPrefCurrentSet, unicode)
-        self.failUnlessIsInstance(kSCPrefNetworkServices, unicode)
-        self.failUnlessIsInstance(kSCPrefSets, unicode)
-        self.failUnlessIsInstance(kSCPrefSystem, unicode)
-        self.failUnlessIsInstance(kSCCompNetwork, unicode)
-        self.failUnlessIsInstance(kSCCompService, unicode)
-        self.failUnlessIsInstance(kSCCompGlobal, unicode)
-        self.failUnlessIsInstance(kSCCompHostNames, unicode)
-        self.failUnlessIsInstance(kSCCompInterface, unicode)
-        self.failUnlessIsInstance(kSCCompSystem, unicode)
-        self.failUnlessIsInstance(kSCCompUsers, unicode)
-        self.failUnlessIsInstance(kSCCompAnyRegex, unicode)
-        self.failUnlessIsInstance(kSCEntNetAirPort, unicode)
-        self.failUnlessIsInstance(kSCEntNetAppleTalk, unicode)
-        self.failUnlessIsInstance(kSCEntNetDHCP, unicode)
-        self.failUnlessIsInstance(kSCEntNetDNS, unicode)
-        self.failUnlessIsInstance(kSCEntNetEthernet, unicode)
-        self.failUnlessIsInstance(kSCEntNetFireWire, unicode)
-        self.failUnlessIsInstance(kSCEntNetInterface, unicode)
-        self.failUnlessIsInstance(kSCEntNetIPv4, unicode)
-        self.failUnlessIsInstance(kSCEntNetIPv6, unicode)
-        self.failUnlessIsInstance(kSCEntNetL2TP, unicode)
-        self.failUnlessIsInstance(kSCEntNetLink, unicode)
-        self.failUnlessIsInstance(kSCEntNetModem, unicode)
-        self.failUnlessIsInstance(kSCEntNetNetInfo, unicode)
-        self.failUnlessIsInstance(kSCEntNetPPP, unicode)
-        self.failUnlessIsInstance(kSCEntNetPPPoE, unicode)
-        self.failUnlessIsInstance(kSCEntNetPPPSerial, unicode)
-        self.failUnlessIsInstance(kSCEntNetPPTP, unicode)
-        self.failUnlessIsInstance(kSCEntNetProxies, unicode)
-        self.failUnlessIsInstance(kSCEntNet6to4, unicode)
-        self.failUnlessIsInstance(kSCPropNetOverridePrimary, unicode)
-        self.failUnlessIsInstance(kSCPropNetServiceOrder, unicode)
-        self.failUnlessIsInstance(kSCPropNetPPPOverridePrimary, unicode)
-        self.failUnlessIsInstance(kSCPropNetInterfaces, unicode)
-        self.failUnlessIsInstance(kSCPropNetLocalHostName, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortAllowNetCreation, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortAuthPassword, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortAuthPasswordEncryption, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortJoinMode, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortPowerEnabled, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortPreferredNetwork, unicode)
-        self.failUnlessIsInstance(kSCPropNetAirPortSavePasswords, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortJoinModeAutomatic, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortJoinModePreferred, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortJoinModeRanked, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortJoinModeRecent, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortJoinModeStrongest, unicode)
-        self.failUnlessIsInstance(kSCValNetAirPortAuthPasswordEncryptionKeychain, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkComputerName, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkComputerNameEncoding, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkConfigMethod, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkDefaultZone, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkNetworkID, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkNetworkRange, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkNodeID, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkSeedNetworkRange, unicode)
-        self.failUnlessIsInstance(kSCPropNetAppleTalkSeedZones, unicode)
-        self.failUnlessIsInstance(kSCValNetAppleTalkConfigMethodNode, unicode)
-        self.failUnlessIsInstance(kSCValNetAppleTalkConfigMethodRouter, unicode)
-        self.failUnlessIsInstance(kSCValNetAppleTalkConfigMethodSeedRouter, unicode)
-        self.failUnlessIsInstance(kSCPropNetDNSDomainName, unicode)
-        self.failUnlessIsInstance(kSCPropNetDNSOptions, unicode)
-        self.failUnlessIsInstance(kSCPropNetDNSSearchDomains, unicode)