[Checkins] SVN: gocept.selenium/branches/jw-staticfiles-testlayer/src/gocept/selenium/static/tests/test_static.py fix up imports and use platform default tmp in test assert

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu Jun 3 08:42:37 EDT 2010


Log message for revision 113000:
  fix up imports and use platform default tmp in test assert

Changed:
  U   gocept.selenium/branches/jw-staticfiles-testlayer/src/gocept/selenium/static/tests/test_static.py

-=-
Modified: gocept.selenium/branches/jw-staticfiles-testlayer/src/gocept/selenium/static/tests/test_static.py
===================================================================
--- gocept.selenium/branches/jw-staticfiles-testlayer/src/gocept/selenium/static/tests/test_static.py	2010-06-03 12:38:45 UTC (rev 112999)
+++ gocept.selenium/branches/jw-staticfiles-testlayer/src/gocept/selenium/static/tests/test_static.py	2010-06-03 12:42:37 UTC (rev 113000)
@@ -12,7 +12,10 @@
 #
 ##############################################################################
 
+import os
+import tempfile
 import unittest
+
 import gocept.selenium.static
 
 class TestStaticFilesTestCase(unittest.TestCase):
@@ -25,10 +28,10 @@
         self.testlayer.tearDown()
 
     def test_documentroot(self):
-        self.assert_(self.testlayer.documentroot.startswith('/tmp'))
+        default_tmp_dir = tempfile.gettempdir()
+        self.assert_(self.testlayer.documentroot.startswith(default_tmp_dir))
 
     def test_documentroot_initially_empty(self):
-        import os
         documentroot = self.testlayer.documentroot
         self.assert_(not os.listdir(self.testlayer.documentroot))
         open(os.path.join(documentroot, 'foo.txt'), 'w').write('Hello World!')
@@ -36,7 +39,6 @@
             ['foo.txt'], os.listdir(self.testlayer.documentroot))
 
     def test_documentroot_empty_after_switchdb(self):
-        import os
         documentroot = self.testlayer.documentroot
         self.assert_(not os.listdir(self.testlayer.documentroot))
         open(os.path.join(documentroot, 'bar.txt'), 'w').write('Hello World!')



More information about the checkins mailing list