[tor-commits] [stem/master] Fix #6248 and make test_get_pid_by_open_file cross-platform while doing so

atagar at torproject.org atagar at torproject.org
Sat Jul 7 20:18:33 UTC 2012


commit bdc71d9c70e6184f7450e1fecef2cb2ce7bc4ac5
Author: Ravi Chandra Padmala <neenaoffline at gmail.com>
Date:   Wed Jun 27 16:44:01 2012 +0530

    Fix #6248 and make test_get_pid_by_open_file cross-platform while doing so
---
 test/integ/util/system.py |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/test/integ/util/system.py b/test/integ/util/system.py
index 968b920..19ea5ea 100644
--- a/test/integ/util/system.py
+++ b/test/integ/util/system.py
@@ -6,6 +6,7 @@ that we're running.
 import os
 import getpass
 import unittest
+import tempfile
 
 import stem.util.system
 import test.runner
@@ -302,16 +303,13 @@ class TestSystem(unittest.TestCase):
     Checks the stem.util.system.get_pid_by_open_file function.
     """
     
-    # on macs this test is unreliable because Quicklook sometimes claims '/tmp'
-    if stem.util.system.is_mac():
-      test.runner.skip(self, "(unreliable due to Quicklook)")
-      return
-    
     # we're not running with a control socket so this just exercises the
     # failure case
     
-    self.assertEquals(None, stem.util.system.get_pid_by_open_file("/tmp"))
-    self.assertEquals(None, stem.util.system.get_pid_by_open_file("/non-existnt-path"))
+    tmpdir = tempfile.mkdtemp()
+    self.assertEquals(None, stem.util.system.get_pid_by_open_file(tmpdir))
+    os.rmdir(tmpdir)
+    self.assertEquals(None, stem.util.system.get_pid_by_open_file(tmpdir))
   
   def test_get_cwd(self):
     """





More information about the tor-commits mailing list