[CalendarServer-changes] [7878] CalendarServer/branches/users/glyph/imip-and-admin-html/ twistedcaldav/test/test_mail.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 11 21:36:02 PDT 2011
Revision: 7878
http://trac.macosforge.org/projects/calendarserver/changeset/7878
Author: glyph at apple.com
Date: 2011-08-11 21:36:02 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
Remove dependency on 'os'.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py
Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py 2011-08-12 04:35:50 UTC (rev 7877)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py 2011-08-12 04:36:02 UTC (rev 7878)
@@ -14,11 +14,12 @@
# limitations under the License.
##
-import os
import datetime
import email
from twisted.internet.defer import inlineCallbacks
+from twisted.python.modules import getModule
+from twisted.python.filepath import FilePath
from twistedcaldav.test.util import TestCase
@@ -63,7 +64,8 @@
def setUp(self):
TestCase.setUp(self)
self.handler = MailHandler(dataRoot=":memory:")
- self.dataDir = os.path.join(os.path.dirname(__file__), "data", "mail")
+ module = getModule(__name__)
+ self.dataPath = module.filePath.sibling("data").child("mail")
def dataFile(self, name):
@@ -71,7 +73,7 @@
Get the contents of a given data file from the 'data/mail' test
fixtures directory.
"""
- return file(os.path.join(self.dataDir, name)).read()
+ return self.dataPath.child(name).getContent()
def test_purge(self):
@@ -102,13 +104,17 @@
def test_iconPath(self):
iconPath = self.handler.getIconPath({'day':'1', 'month':'1'}, False,
language='en')
- iconDir = "/usr/share/caldavd/share/date_icons"
- if os.path.exists(iconDir):
- if os.path.exists("%s/JAN/01.png" % (iconDir,)):
- self.assertEquals(iconPath, "%s/JAN/01.png" % (iconDir,))
+ iconDir = FilePath("/usr/share/caldavd/share/date_icons")
+
+ if iconDir.exists():
+ if iconDir.child("JAN").child("01.png"):
+ monthName = "JAN"
else:
- self.assertEquals(iconPath, "%s/01/01.png" % (iconDir,))
+ monthName = "01"
+ monthPath = iconDir.child(monthName)
+ self.assertEquals(iconPath, monthPath.child("01.png").path)
+
def test_checkDSNFailure(self):
data = {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/fa151e73/attachment.html>
More information about the calendarserver-changes
mailing list