[cedar-backup-svn] SF.net SVN: cedar-backup:[969] cedar-backup2/trunk
Brought to you by:
pronovic
|
From: <pro...@us...> - 2010-05-22 16:26:02
|
Revision: 969
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=969&view=rev
Author: pronovic
Date: 2010-05-22 16:25:56 +0000 (Sat, 22 May 2010)
Log Message:
-----------
Set up command overrides properly so full test suite works on Debian
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/testutil.py
cedar-backup2/trunk/Changelog
cedar-backup2/trunk/util/test.py
Modified: cedar-backup2/trunk/CedarBackup2/testutil.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/testutil.py 2010-05-22 16:14:52 UTC (rev 968)
+++ cedar-backup2/trunk/CedarBackup2/testutil.py 2010-05-22 16:25:56 UTC (rev 969)
@@ -52,8 +52,8 @@
@sort: findResources, commandAvailable,
buildPath, removedir, extractTar, changeFileAge,
getMaskAsMode, getLogin, failUnlessAssignRaises, runningAsRoot,
- platformMacOsX, platformWindows, platformHasEcho,
- platformSupportsLinks, platformSupportsPermissions,
+ platformDebian, platformMacOsX, platformCygwin, platformWindows,
+ platformHasEcho, platformSupportsLinks, platformSupportsPermissions,
platformRequiresBinaryRead
@author: Kenneth J. Pronovici <pro...@ie...>
@@ -76,6 +76,9 @@
from StringIO import StringIO
from CedarBackup2.util import encodePath, executeCommand
+from CedarBackup2.config import Config, OptionsConfig
+from CedarBackup2.customize import customizeOverrides
+from CedarBackup2.cli import setupPathResolver
########################################################################
@@ -105,6 +108,33 @@
logger.addHandler(handler)
+#################
+# setupOverrides
+#################
+
+def setupOverrides():
+ """
+ Set up any platform-specific overrides that might be required.
+
+ When packages are built, this is done manually (hardcoded) in customize.py
+ and the overrides are set up in cli.cli(). This way, no runtime checks need
+ to be done. This is safe, because the package maintainer knows exactly
+ which platform (Debian or not) the package is being built for.
+
+ Unit tests are different, because they might be run anywhere. So, we
+ attempt to make a guess about plaform using platformDebian(), and use that
+ to set up the custom overrides so that platform-specific unit tests continue
+ to work.
+ """
+ config = Config()
+ config.options = OptionsConfig()
+ if platformDebian():
+ customizeOverrides(config, platform="debian")
+ else:
+ customizeOverrides(config, platform="standard")
+ setupPathResolver(config)
+
+
###########################
# findResources() function
###########################
@@ -387,6 +417,8 @@
return platform.platform(True, True).startswith("Windows")
elif name == "macosx":
return sys.platform == "darwin"
+ elif name == "debian":
+ return platform.platform(False, False).find("debian") > 0
elif name == "cygwin":
return platform.platform(True, True).startswith("CYGWIN")
else:
@@ -394,6 +426,17 @@
############################
+# platformDebian() function
+############################
+
+def platformDebian():
+ """
+ Returns boolean indicating whether this is the Debian platform.
+ """
+ return _isPlatform("debian")
+
+
+############################
# platformMacOsX() function
############################
Modified: cedar-backup2/trunk/Changelog
===================================================================
--- cedar-backup2/trunk/Changelog 2010-05-22 16:14:52 UTC (rev 968)
+++ cedar-backup2/trunk/Changelog 2010-05-22 16:25:56 UTC (rev 969)
@@ -2,6 +2,7 @@
* Work around strange stderr file descriptor bugs discovered on Cygwin.
* Tweak expected results for tests that fail on Cygwin with Python 2.5.x.
+ * Set up command overrides properly so full test suite works on Debian.
Version 2.19.5 10 Jan 2010
Modified: cedar-backup2/trunk/util/test.py
===================================================================
--- cedar-backup2/trunk/util/test.py 2010-05-22 16:14:52 UTC (rev 968)
+++ cedar-backup2/trunk/util/test.py 2010-05-22 16:25:56 UTC (rev 969)
@@ -134,6 +134,10 @@
print "tree, or properly set the PYTHONPATH enviroment variable."
return 1
+ # Setup platform-specific command overrides
+ from CedarBackup2.testutil import setupOverrides
+ setupOverrides()
+
# Import the unit test modules
try:
if os.path.exists(os.path.join(".", "test", "filesystemtests.py")):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|