[Scons-users] Fwd: Writing test cases for Issue 2615

William Blevins wblevins001 at gmail.com
Tue Oct 11 16:38:00 EDT 2016


Adarsh,

HG blame claims that the CacheDirTests.py code was written back in 2007, so
I am going to go out on a limb here and say that the CacheDir not getting
written into the SCons.Test workspace is a bug in the test code. This test
may have been written prior to some of the newer SCons.Test novelties.

As a good rule of thumb, no disk operations specific to the test should
happen outside the SCons.Test workspace. If runtests.py script ran
individual tests in parallel (it runs separate test files in parallel but
not individual tests), these would obviously compete and implode.

I will let the admin chime in if they disagree, but I would definitely
update the tests to correct this issue. This would include putting the
CacheDir into the workspace and removing the BaseTest teardown code such
that PRESERVE works as intended without needing to modify the script.

I try to keep things short and sweet. Let me know if you need any
clarification.

V/R,
William

On Tue, Oct 11, 2016 at 4:00 PM, Adarsh Sanjeev <adarshsanjeev at gmail.com>
wrote:

> Hi,
>
> Yes, I had pushed it after, just some timezone issues which changed the
> time. I did not inherit CacheReadOnlyTestCase from BaseTestCase, as I
> needed a setup and teardown functions which changes the permission of the
> caches parent directory, so even If I had inherited it, I would have to
> override those two functions anyway.
>
> Thank you!
>
> On Tue, Oct 11, 2016 at 6:32 PM, William Blevins <wblevins001 at gmail.com>
> wrote:
>
>> Adarsh,
>>
>> Did you push your additional changes? The only commits in your repo are
>> listed from 9/4/2016 which is prior to Dirk's comments.
>>
>> I noticed that the latest b1abe00
>> <https://bitbucket.org/adarshsanjeev/scons/commits/b1abe00dc4b82697f6a3b508ecffca359a4712f2>
>> do not inherit CacheReadOnlyTestCase from BaseTestCase which already
>> provides an self.fs and self.File which may be useful.
>>
>> V/R,
>> William
>>
>> On Tue, Oct 11, 2016 at 3:18 AM, Adarsh Sanjeev <adarshsanjeev at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I was working on Issue #2615, and was stuck at a point, so I had sent an
>>> email, for some information, but I did not get any replies, hence, I am
>>> sending it again.
>>>
>>> Thank you!
>>>
>>> ---------- Forwarded message ----------
>>> From: Adarsh Sanjeev <adarshsanjeev at gmail.com>
>>> Date: Tue, Sep 6, 2016 at 8:15 AM
>>> Subject: Re: [Scons-users] Writing test cases for Issue 2615
>>> To: SCons users mailing list <scons-users at scons.org>
>>>
>>>
>>> Hi,
>>>
>>> I have made the changes that were suggested, but I am unable to
>>> understand part of the code. In all the TestCases, in the setUp, TestCmd is
>>> used to create a temporary directory. However, this is not passed to the
>>> CacheDir constructor, and the cache is made in the scons directory itself.
>>> I do not understand why the Cache is not made in the temporary directory.
>>> If this is the intended behaviour, should I make the permission of the
>>> scons directory read only?
>>>
>>> Thanks!
>>>
>>> On Mon, Sep 5, 2016 at 9:32 PM, Dirk Bächle <tshortik at gmx.de> wrote:
>>>
>>>> Hi Adarsh,
>>>>
>>>> the "test_*" methods themselves shouldn't "return" (=possibly skipping
>>>> parts of the test) and for the basic checking of exceptions you might want
>>>> to have a look at "test_warning()" in the same file.
>>>>
>>>> To my knowledge there is no function built-in to SCons for checking the
>>>> attributes of a directory entry, but using Python modules/packages is fine
>>>> in general.
>>>>
>>>> Best regards,
>>>>
>>>> Dirk
>>>>
>>>> On 04.09.2016 08:51, Adarsh Sanjeev wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to solve Issue 2615 on the tracker (No error on create
>>>>> Cache in read only directory).
>>>>>
>>>>> I have, so far, added another test case to
>>>>> engine/Scons/CacheDirTests.py, where I make the directory read only and
>>>>> calls the
>>>>> CacheDir constructor there. If it finishes the constructor without any
>>>>> exception, I fail the test.
>>>>>
>>>>> These
>>>>> <https://bitbucket.org/adarshsanjeev/scons/src/b1abe00dc4b82
>>>>> 697f6a3b508ecffca359a4712f2/src/engine/SCons/CacheDirTests.p
>>>>> y?at=default&fileviewer=file-view-default#CacheDirTests.py-90>
>>>>> are the changes I made. Is this okay so far?
>>>>>
>>>>> On fixing the issue itself, is there any function within scons to
>>>>> check if a directory is writable or should I just use the os module?
>>>>>
>>>>> --
>>>>> 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
>>>
>>>
>>>
>>> --
>>> 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
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20161011/8487ba03/attachment-0001.html>


More information about the Scons-users mailing list