Stefan Krah added the comment:

This gets rid of the permission error:

diff -r f962ec8e47a1 Lib/test/test_mmap.py                                      
                          
--- a/Lib/test/test_mmap.py     Mon Sep 10 01:23:05 2012 +0200                  
                          
+++ b/Lib/test/test_mmap.py     Mon Sep 10 22:22:38 2012 +0200                  
                          
@@ -491,11 +491,11 @@                                                           
                          
     def test_empty_file (self):                                                
                          
         f = open (TESTFN, 'w+b')                                               
                          
         f.close()                                                              
                          
-        f = open(TESTFN, "rb")                                                 
                          
-        self.assertRaisesRegex(ValueError,                                     
                          
-                               "cannot mmap an empty file",                    
                          
-                               mmap.mmap, f.fileno(), 0, 
access=mmap.ACCESS_READ)                        
-        f.close()                                                              
                          
+        with open(TESTFN, "rb") as f:                                          
                          
+            self.assertRaisesRegex(ValueError,                                 
                          
+                                   "cannot mmap an empty file",                
                          
+                                   mmap.mmap, f.fileno(), 0,                   
                          
+                                   access=mmap.ACCESS_READ)                    
                          
                                                                                
                          
     def test_offset (self):                                                    
                          
         f = open (TESTFN, 'w+b')                                               
                          
                                                          




But the test still fails:



== CPython 3.3.0rc2+ (default, Sep 10 2012, 22:01:26) [MSC v.1600 64 bit 
(AMD64)]                         
==   Windows-7-6.1.7601-SP1 little-endian                                       
                          
==   C:\Users\stefan\pydev\cpython\build\test_python_2908                       
                          
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_use
r_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, 
hash_randomization=1)     
[1/1] test_mmap                                                                 
                          
test_empty_file (test.test_mmap.MmapTests) ... FAIL                             
                          
                                                                                
                          
======================================================================          
                          
FAIL: test_empty_file (test.test_mmap.MmapTests)                                
                          
----------------------------------------------------------------------          
                          
ValueError: mmap offset is greater than file size                               
                          
                                                                                
                          
During handling of the above exception, another exception occurred:             
                          
                                                                                
                          
Traceback (most recent call last):                                              
                          
  File "C:\Users\stefan\pydev\cpython\lib\test\test_mmap.py", line 498, in 
test_empty_file                
    access=mmap.ACCESS_READ)                                                    
                          
AssertionError: "cannot mmap an empty file" does not match "mmap offset is 
greater than file size"

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15676>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to