[Scons-users] 2615 Issue

Schleimer, Ben bensch128 at yahoo.com
Mon Feb 29 14:12:35 EST 2016


Hi Adarsh,   I believe that it replaces CachePush with it's own function so that it can test the results of File.push_to_cache() (which is kinda strange, that should be in the FS or Node tests...)

   I might have overstated what your new unittest should cover. Since issue 2615 only asks that an error should be reported if scons fails to create the cache directory, then thats what you should test for. Make a read-only directory and then try to create a cache in that directory. Make sure an error is reported. Thats all. 

The reason I suggested making another TestCase instead of using FileTestCase is because BaseTestCase constructs the cache in setup(). An ideal test for issue 2615 would make the cache directory readonly before constructing the cache.

There are other issues with the CacheDir.py code (like setting the cache dir writable in CacheRetrieveFunc()?? and cache_readonly never gets set) but thats not required to be tested in issue 2615.
I think that scons' unit tests are mostly based on the unittest module and should just follow how unittest is normally used.

CheersBen
 

    On Monday, February 29, 2016 8:41 AM, Adarsh Sanjeev <adarshsanjeev at gmail.com> wrote:
 
 

 Hi,

I'm still working on this issue, and I have gone through the source code for CacheDirTests.py. I do not understand why test_CachePush replaces the function with its own self.push for the test, if it is testing it. 

As per what you said, I do not understand why two cacheDirs have to be made to test for read only. Isn't it enough to push a file to a read only cache? Furthermore, is a read only cache the only case that I should handle? What about if os.makedir fails for the cache? 

Also, is there any documentation specifically on writing tests for scons, other that the unittest documentation?

Thanks!

On Thu, Feb 18, 2016 at 11:53 PM, Schleimer, Ben via Scons-users <scons-users at scons.org> wrote:

Hi Adarsh,   
   test_CachePush() always assumes that the push will suceed.

   You proabably will want to create a new test case for the issue. Briefly looking at the CacheDir() code, it seems that readonly is never checked.
I would make a TestCase that creates a CacheDir, makes it's path readonly and then creates another CacheDir with the same path and checks its readonly state and behavior when it tries to push.
CheersBen


 

    On Thursday, February 18, 2016 8:51 AM, Adarsh Sanjeev <adarshsanjeev at gmail.com> wrote:
 
 

 I was trying to solve issue 2615 in the tracker, which is no error message on failure to create the cache directory. I am attempting to write a test for this case, in 

186: test_CachePush : src/engine/SCons/CacheDirTests.py.

 Am I on the right path? Also, can anyone guide me on writing the test for this case?

-- 
Adarsh Sanjeev
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users


 
   
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users





-- 
Adarsh Sanjeev

 
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160229/be835849/attachment.html>


More information about the Scons-users mailing list