[asterisk-dev] [Code Review] 4083: testsuite: use replace instead of lstrip to remove portion of string
wdoekes
reviewboard at asterisk.org
Wed Oct 15 09:52:30 CDT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4083/#review13526
-----------------------------------------------------------
/asterisk/trunk/lib/python/asterisk/sippversion.py
<https://reviewboard.asterisk.org/r/4083/#comment24042>
sipp = line.strip()[5:]
/asterisk/trunk/runtests.py
<https://reviewboard.asterisk.org/r/4083/#comment24043>
I assume that the test_name *always* starts with "tests/". Then you should just strip 6 characters from the start: ...test_name[6:].
replace() would replace strings in the middle as well, which is still wrong.
/asterisk/trunk/runtests.py
<https://reviewboard.asterisk.org/r/4083/#comment24044>
Idem.
And please fix the indentation while you're here:
- either 4 spaces
- or lined up after the parenthesis above
/asterisk/trunk/runtests.py
<https://reviewboard.asterisk.org/r/4083/#comment24045>
Idem.
- wdoekes
On Oct. 14, 2014, 10 p.m., Scott Griepentrog wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4083/
> -----------------------------------------------------------
>
> (Updated Oct. 14, 2014, 10 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: testsuite
>
>
> Description
> -------
>
> When a core dump occurs, if the test path started with t, e, or s, those characters would get stripped out from the path created to store the backtrace file. This is due to incorrect usage of lstrip, which removes all instances of any of the provided characters from the start of the string regardless of the order:
>
> >>> print 'tests/something'.lstrip('tests/')
> omething
>
> This patch changes lstrip to replace in several places, where the intent was clearly to remove only an exact string from another.
>
>
> Diffs
> -----
>
> /asterisk/trunk/runtests.py 5730
> /asterisk/trunk/lib/python/asterisk/sippversion.py 5730
>
> Diff: https://reviewboard.asterisk.org/r/4083/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Scott Griepentrog
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141015/0230cf86/attachment-0001.html>
More information about the asterisk-dev
mailing list