[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Allow stem.util.system integ testing without PATH



commit dfe8184218a6b531f8d64edddc4f6092db25c5c9
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue May 23 15:57:48 2017 -0700

    Allow stem.util.system integ testing without PATH
    
    Checking that we have a PATH for the tests that require it...
    
      ======================================================================
      ERROR: test_pids_by_user
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/integ/util/system.py", line 323, in test_pids_by_user
          self.assertTrue(os.getpid() in pids)
      TypeError: argument of type 'NoneType' is not iterable
    
      ======================================================================
      FAIL: test_is_available
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/integ/util/system.py", line 82, in test_is_available
          self.assertTrue(stem.util.system.is_available('ls'))
      AssertionError: False is not true
    
      ======================================================================
      FAIL: test_pid_by_name
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/require.py", line 58, in wrapped
          return func(self, *args, **kwargs)
        File "/home/atagar/Desktop/stem/test/integ/util/system.py", line 111, in test_pid_by_name
          self.assertEqual(tor_pid, stem.util.system.pid_by_name(tor_cmd))
      AssertionError: 2908 != None
---
 test/integ/util/system.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/integ/util/system.py b/test/integ/util/system.py
index 912251b..07d7d75 100644
--- a/test/integ/util/system.py
+++ b/test/integ/util/system.py
@@ -66,9 +66,11 @@ require_single_tor_instance = test.require.needs(_is_single_tor_running, 'multip
 require_control_port = test.require.needs(_has_port, 'test instance has no port')
 require_linux = test.require.needs(_is_linux, 'linux only')
 require_bsd = test.require.needs(stem.util.system.is_bsd, 'bsd only')
+require_path = test.require.needs(lambda: 'PATH' in os.environ, 'requires PATH')
 
 
 class TestSystem(unittest.TestCase):
+  @require_path
   def test_is_available(self):
     """
     Checks the stem.util.system.is_available function.
@@ -99,6 +101,7 @@ class TestSystem(unittest.TestCase):
     self.assertTrue(stem.util.system.is_running(tor_cmd) or stem.util.system.is_running('tor.real'))
     self.assertFalse(stem.util.system.is_running('blarg_and_stuff'))
 
+  @require_path
   @require_single_tor_instance
   def test_pid_by_name(self):
     """
@@ -312,6 +315,7 @@ class TestSystem(unittest.TestCase):
     os.rmdir(tmpdir)
     self.assertEqual(None, stem.util.system.pid_by_open_file(tmpdir))
 
+  @require_path
   def test_pids_by_user(self):
     """
     Checks the stem.util.system.pids_by_user function.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits