[tor-commits] [stem/master] stem.process integ test with RUN_SOCKET target broken

atagar at torproject.org atagar at torproject.org
Sun Nov 4 19:11:39 UTC 2012


commit c58514337ec02d17260c9468ba17b1a15f959c82
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Nov 4 11:04:42 2012 -0800

    stem.process integ test with RUN_SOCKET target broken
    
    Ok, this puzzled me for a while. Our stem.process integ tests make
    '/tmp/stem_integ' to be its temporary data directory for the run, then cleans
    it up afterward.
    
    This is great, except that the RUN_SOCKET causes us to run with the following
    in its torrc...
    
    ControlSocket /tmp/stem_integ/socket
    
    It's a coincidence that both use the same tmp directory, but it's not
    necessarily bad. What was bad, though, is that...
    
    * the stem.process tests broke since the mkdir call for stem_integ failed
    * if that hadn't failed our tearDown would have deleted stem_integ, and with it
      our control socket causing all further tests to fail
    
    We should probably use the tempfile module to make our stem.process data
    directory, but for now just being lazy and having it account for the RUN_SOCKET
    target.
    
    Caught by Ravi on...
    https://trac.torproject.org/7284
---
 test/integ/process.py |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/test/integ/process.py b/test/integ/process.py
index 127eb40..fc2825a 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -18,11 +18,9 @@ DATA_DIRECTORY = '/tmp/stem_integ'
 
 class TestProcess(unittest.TestCase):
   def setUp(self):
-    os.makedirs(DATA_DIRECTORY)
+    if not os.path.exists(DATA_DIRECTORY):
+      os.makedirs(DATA_DIRECTORY)
   
-  def tearDown(self):
-    shutil.rmtree(DATA_DIRECTORY, ignore_errors = True)
-    
   def test_launch_tor_with_config(self):
     """
     Exercises launch_tor_with_config.



More information about the tor-commits mailing list