This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients Steven.Willis, jcea, neologix, python-dev, skrah
Date 2012-09-10.20:33:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347309212.17.0.455786688061.issue15676@psf.upfronthosting.co.za>
In-reply-to
Content
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"
History
Date User Action Args
2012-09-10 20:33:32skrahsetrecipients: + skrah, jcea, neologix, python-dev, Steven.Willis
2012-09-10 20:33:32skrahsetmessageid: <1347309212.17.0.455786688061.issue15676@psf.upfronthosting.co.za>
2012-09-10 20:33:31skrahlinkissue15676 messages
2012-09-10 20:33:31skrahcreate