[TIP] are the absolute paths in .coverage necessary?

Chris Withers chris at simplistix.co.uk
Mon Nov 21 15:02:26 PST 2016


Can you give me some examples where the paths don't make sense relative 
to the current directory?

I'm struggling to think of them. If they're the edge case, maybe they 
could need a config file rather than having the more common case where 
relative-to-cwd would work fine?

cheers,

Chris

On 17/10/2016 02:40, Ned Batchelder wrote:
> There's no guarantee that all of the paths make sense as relative to the
> current directory, since they might not be below the current directory.
> The [paths] feature was meant to solve this problem, but I guess it
> isn't working for you?
>
> --Ned.
>
>
> On 10/16/16 2:44 PM, Chris Withers wrote:
>> Hi Ned,
>>
>> Sorry, I meant: do the paths recorded in the .coverage files need to
>> be absolute or could Coverage be changed to just record the path
>> relatively to the current working directory at the start of execution?
>>
>> cheers,
>>
>> Chris
>>
>>
>> On 12/10/2016 22:31, Ned Batchelder wrote:
>>> Chris, as far as I can tell, they do not have to be absolute. As you can
>>> see from the sample of my rc file, you can replace an arbitrary prefix
>>> with *, and it will work just fine.  How about this:
>>>
>>> [paths]
>>> mylib =
>>>    mylib
>>>    */workspace/PYTHON/*/mylib
>>> tests =
>>>    tests
>>>    */workspace/PYTHON/*/tests
>>>
>>> --Ned.
>>>
>>>
>>> On 10/12/16 10:59 AM, Chris Withers wrote:
>>>> What I currently have is:
>>>>
>>>> [paths]
>>>> mylib =
>>>>    mylib
>>>>    /data/jenkins/jobs/mylib-test/workspace/PYTHON/*/mylib
>>>> tests =
>>>>    tests
>>>>    /data/jenkins/jobs/mylib-test/workspace/PYTHON/*/tests
>>>>
>>>> How can I remove the absolute bits of that?
>>>>
>>>> But, back to my original question: why are the paths in .coverage
>>>> absolute in the first place? :-)
>>>>
>>>> Chris
>>>>
>>>> On 12/10/2016 15:53, Ned Batchelder wrote:
>>>>> Chris, can you show the absolute paths you are using?  I have this
>>>>> in my
>>>>> rc file to deal with varieties of CI:
>>>>>
>>>>>      [paths]
>>>>>      source =
>>>>>          .
>>>>>          *\coverage\trunk
>>>>>          */coverage/trunk
>>>>>          *\coveragepy
>>>>>
>>>>> --Ned.
>>>>>
>>>>>
>>>>> On 10/12/16 10:00 AM, Chris Withers wrote:
>>>>>> Hi Ned,
>>>>>>
>>>>>> Are the absolute paths necessary in .coverage?
>>>>>>
>>>>>> The reason I ask is that if, for example, they were relative to the
>>>>>> cwd, then I wouldn't need a .coveragerc with a whole bunch of paths
>>>>>> predicated on the exact filesystem layout of my CI server.
>>>>>>
>>>>>> thoughts?
>>>>>>
>>>>>> Chris
>>
>



More information about the testing-in-python mailing list