[tor-commits] [stem/master] Skip two test cases in test.integ.descriptor.reader on windows.

atagar at torproject.org atagar at torproject.org
Thu Jun 21 15:45:57 UTC 2012


commit 73277fc0dc9709b56fd69fa0d0c0dec2effcb2c9
Author: Beck Chen <csybeck at gmail.com>
Date:   Fri Jun 15 12:18:03 2012 +0800

    Skip two test cases in test.integ.descriptor.reader on windows.
    
    The two test cases are test_load_processed_files_permissions and
    test_skip_listener_read_failure. They both call os.chmod() to change
    permissions of the test file, but on windows, you can only set the
    file's read-only flag with it and all other bits are ignored. This
    would cause tearDown() to fail since test files are read-only and
    can't be removed, thus fail all the test cases.
---
 test/integ/descriptor/reader.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index 308e9fe..152f839 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -106,6 +106,12 @@ class TestDescriptorReader(unittest.TestCase):
     due to permissions.
     """
     
+    # Skip the test on windows, since you can only set the file's
+    # read-only flag with os.chmod(). See
+    # http://docs.python.org/library/os.html#os.chmod
+    if system.is_windows():
+      self.skipTest("(chmod not functional)")
+    
     test_listing_path = _make_processed_files_listing(BASIC_LISTING)
     os.chmod(test_listing_path, 0077) # remove read permissions
     self.assertRaises(IOError, stem.descriptor.reader.load_processed_files, test_listing_path)
@@ -407,6 +413,12 @@ class TestDescriptorReader(unittest.TestCase):
     Listens for a file that's skipped because we lack read permissions.
     """
     
+    # Skip the test on windows, since you can only set the file's
+    # read-only flag with os.chmod(). See
+    # http://docs.python.org/library/os.html#os.chmod
+    if system.is_windows():
+      self.skipTest("(chmod not functional)")
+    
     test_path = test.runner.get_runner().get_test_dir("secret_file")
     
     try:





More information about the tor-commits mailing list