[Piuparts-devel] Tests for piupartslib.dwke

Herbert Fortes terberh at gmail.com
Sun Feb 17 20:02:39 GMT 2019


On 2/15/19 11:58 AM, Herbert Fortes wrote:
> On 2/15/19 7:58 AM, Herbert Fortes wrote:
>> Hi,
>>
>> I created tests/test_dwke.py for piupartslib.dwke. Two of them 
>> maybe not really necessary. But helped me to get started.
>>
>> To test make_kprs function I split it into more four functions. 
>> Simplify tests. Skips read/write a file.
>>
>> Then I noted the IOError can happen because of two open() with 
>> two different paths. But only one path is used to compose the log
>> message. The paths differ because of a 'replace_ext()'. I created
>> 'read file' and 'write file' functions. Each one uses its own path
>> for logging. 
>>
>> Please check if the patch[0] worth apply. (5 commits patch)
>>
>> Add tests/test_dwke.py
>> Create kprs_string function
>> Create read_logpath function
>> Create write_kprs function
>> Create build_kprs function
>>
>>
>> [0] - https://github.com/hpfn-d/piuparts_3/pull/20
>>
> 
> I did a mess in the PR.
> 
> Not necessary revert.
> 

I fixed the mess and made the 'test_build_kprs_without_logbody'
more explicit, readable.

The test works as expected but I put:

 - .AndReturn(None)
 - a self.fail(message)

Instead of a silent self.assertIsNone.

https://github.com/hpfn-d/piuparts_3/pull/20




More information about the Piuparts-devel mailing list