Dan Kenigsberg has submitted this change and it was merged.
Change subject: tests: fixed mangled names in crossImportTests
......................................................................
tests: fixed mangled names in crossImportTests
crossImportTests needs to extract the module name given
a python file. To do this, it uses a naive approach stripping the
extension of a filename, being the extension either ".py" or ".pyc".
This approach seems good enough for the test purposes, but it was
done incorrectly using the strip() method of string objects,
like
filename.strip(".pyc")
Unfortunately, as per strip() documentation:
strip(...)
S.strip([chars]) -> string or unicode
[...]
If chars is given and not None, remove characters in chars instead.
[...]
This means that *any* occurrence of *any* char provided will be removed,
not just the substring as a whole. This leads to incorrect output.
For example
"cmdutils.pyc".strip(".pyc") -> "mdutils"
This patch fixes that using the more suitable os.path.splitext()
function. We take the chance to add an unit test for the get_mods()
helper, to make sure this won't happen again (or at least, not so
easily).
Change-Id: I53ba5fbc2f43fbafe9f6f291fcf2402986a5948c
Signed-off-by: Francesco Romani <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/46939
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M tests/crossImportsTests.py.in
1 file changed, 30 insertions(+), 4 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
Francesco Romani: Verified
--
To view, visit https://gerrit.ovirt.org/46939
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I53ba5fbc2f43fbafe9f6f291fcf2402986a5948c
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: [email protected]
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches