tests: Fix python path in runtests.py#137
Closed
orbea wants to merge 1 commit intomanugarg:masterfrom
Closed
Conversation
Contributor
Author
|
Seems some of the CI tests aren't happy with this idea... |
Contributor
Author
|
My second attempt works for CI and local builds at least. |
In Gentoo the runtests.py script fails when it fails to determine the
pacparser path.
This happens because 'py_ver' expands to '3.9' when the expected
directory ends in '39'. This can be solved by replacing any periods in
the string.
python ../tests/runtests.py
Traceback (most recent call last):
File "/tmp/pacparser/src/../tests/runtests.py", line 31, in runtests
pacparser_module_path = glob.glob(os.path.join(
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pacparser/src/../tests/runtests.py", line 81, in <module>
main()
File "/tmp/pacparser/src/../tests/runtests.py", line 78, in main
runtests(pacfile, testdata, tests_dir)
File "/tmp/pacparser/src/../tests/runtests.py", line 34, in runtests
raise Exception('Tests failed. Could not determine pacparser path.')
Exception: Tests failed. Could not determine pacparser path.
orbea
added a commit
to orbea/gentoo
that referenced
this pull request
May 14, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Signed-off-by: orbea <orbea@riseup.net>
orbea
added a commit
to orbea/gentoo
that referenced
this pull request
May 14, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Signed-off-by: orbea <orbea@riseup.net>
orbea
added a commit
to orbea/gentoo
that referenced
this pull request
May 14, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#106 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Upstream-Commit: manugarg/pacparser@c6258eb Signed-off-by: orbea <orbea@riseup.net>
orbea
added a commit
to orbea/gentoo
that referenced
this pull request
May 14, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#106 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Upstream-Commit: manugarg/pacparser@c6258eb Signed-off-by: orbea <orbea@riseup.net>
orbea
added a commit
to orbea/gentoo
that referenced
this pull request
May 14, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#106 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Upstream-Commit: manugarg/pacparser@c6258eb Signed-off-by: orbea <orbea@riseup.net>
gentoo-bot
pushed a commit
to gentoo/gentoo
that referenced
this pull request
May 15, 2022
Bug: https://bugs.gentoo.org/793425 Upstream-PR: manugarg/pacparser#106 Upstream-PR: manugarg/pacparser#136 Upstream-PR: manugarg/pacparser#137 Upstream-Commit: manugarg/pacparser@c6258eb Signed-off-by: orbea <orbea@riseup.net> Closes: #25487 Signed-off-by: Sam James <sam@gentoo.org>
Merged
smuzaffar
reviewed
Sep 21, 2022
Comment on lines
+29
to
+42
| ver = '.'.join([str(x) for x in sys.version_info[0:2]]) | ||
| py_ver = [ver, ver.replace('.', '')] | ||
| try: | ||
| pacparser_module_path = glob.glob(os.path.join( | ||
| tests_dir, '..', 'src', 'pymod', 'build', 'lib*%s' % py_ver))[0] | ||
| module_path = glob.glob(os.path.join( | ||
| tests_dir, '..', 'src', 'pymod', 'build', 'lib*')) | ||
| module_found = False | ||
| for module in module_path: | ||
| for version in py_ver: | ||
| if module.endswith(version): | ||
| module_found = True | ||
| break | ||
| if module_found: | ||
| pacparser_module_path = module | ||
| break |
There was a problem hiding this comment.
@orbea , I also got the same error while building with python 3.9. A simpel change like works
Suggested change
| ver = '.'.join([str(x) for x in sys.version_info[0:2]]) | |
| py_ver = [ver, ver.replace('.', '')] | |
| try: | |
| pacparser_module_path = glob.glob(os.path.join( | |
| tests_dir, '..', 'src', 'pymod', 'build', 'lib*%s' % py_ver))[0] | |
| module_path = glob.glob(os.path.join( | |
| tests_dir, '..', 'src', 'pymod', 'build', 'lib*')) | |
| module_found = False | |
| for module in module_path: | |
| for version in py_ver: | |
| if module.endswith(version): | |
| module_found = True | |
| break | |
| if module_found: | |
| pacparser_module_path = module | |
| break | |
| py_ver = "%s*" & sys.version_info[0] | |
| try: | |
| pacparser_module_path = glob.glob(os.path.join( | |
| tests_dir, '..', 'src', 'pymod', 'build', 'lib*%s' % py_ver))[0] |
so basically just using py_ver = "%s*" & sys.version_info[0] was enough.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please review that I am solving this correctly, thanks!
In Gentoo the
runtests.pyscript fails when it fails to determine the pacparser path.This happens because
py_verexpands to3.9when the expected directory ends in39. This can be solved by replacing any periods in the string.Full build log: pacparser.pymod.log
Reproduction:
make -C src pymod