Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug in experiment_unittests #434

Merged
merged 2 commits into from
Feb 2, 2024
Merged

Conversation

tjk584
Copy link
Contributor

@tjk584 tjk584 commented Feb 1, 2024

There was a problem with pkgutil.itermodules where passing a Path() object worked for certain python versions, but not others. Passing a string works for all versions.

The error this bugfix fixes was:

Traceback (most recent call last):
  File "/usr/lib64/python3.10/pkgutil.py", line 417, in get_importer
    importer = sys.path_importer_cache[path_item]
KeyError: PosixPath('/home/radar/borealis/src/borealis_experiments')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/radar/borealis//tests/experiments/experiment_unittests.py", line 372, in <module>
    run_tests(sys.argv[1:])
  File "/home/radar/borealis//tests/experiments/experiment_unittests.py", line 332, in run_tests
    build_experiment_tests(experiments, args.kwargs)
  File "/home/radar/borealis//tests/experiments/experiment_unittests.py", line 249, in build_experiment_tests
    for (_, name, _) in pkgutil.iter_modules([Path(experiment_path)]):
  File "/usr/lib64/python3.10/pkgutil.py", line 129, in iter_modules
    for i in importers:
  File "/usr/lib64/python3.10/pkgutil.py", line 421, in get_importer
    importer = path_hook(path_item)
  File "<frozen importlib._bootstrap_external>", line 1632, in path_hook_for_FileFinder
  File "<frozen importlib._bootstrap_external>", line 1504, in __init__
  File "<frozen importlib._bootstrap_external>", line 182, in _path_isabs
AttributeError: 'PosixPath' object has no attribute 'startswith'

See python/cpython#88227 for more info

@tjk584 tjk584 added bug quick review A quick to review PR labels Feb 1, 2024
@tjk584 tjk584 self-assigned this Feb 1, 2024
Copy link
Contributor

@Doreban Doreban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me

@RemingtonRohel RemingtonRohel merged commit 7cbced8 into develop Feb 2, 2024
@RemingtonRohel RemingtonRohel deleted the bugfix/exp_unittests branch February 2, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug quick review A quick to review PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants