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

use importlib instead of deprecated imp module #77

Merged
merged 13 commits into from
Aug 23, 2023
Merged

Conversation

rathann
Copy link
Contributor

@rathann rathann commented Aug 17, 2023

This fixes tests with python 3.12 where the imp module was removed.

This should fix issue #74.

@wbond
Copy link
Owner

wbond commented Aug 17, 2023

I've tried a few implementations, but the new importlib API is far more complex, so it will require some more work to get it right.

@wbond
Copy link
Owner

wbond commented Aug 17, 2023

@rathann Can you test out this version on 3.12? I'd try python run.py tests and python run.py ci

@rathann
Copy link
Contributor Author

rathann commented Aug 18, 2023

@wbond thanks a lot for working on this. python run.py tests passes, but python run.py ci fails with:

$ python3 run.py ci
Traceback (most recent call last):
  File "/builddir/build/BUILD/oscrypto-1.3.0/run.py", line 8, in <module>
    run_task()
  File "/builddir/build/BUILD/oscrypto-1.3.0/dev/_task.py", line 134, in run_task
    task_mod = _import_from('dev.%s' % task, package_root, allow_error=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/oscrypto-1.3.0/dev/_import.py", line 80, in _import_from
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
  File "/builddir/build/BUILD/oscrypto-1.3.0/dev/ci.py", line 24, in <module>
    from .coverage import run as run_coverage
  File "/builddir/build/BUILD/oscrypto-1.3.0/dev/coverage.py", line 7, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

Looks like we missed at least one instance of imp usage.

This fixes `python run.py ci` under python 3.12.
@rathann
Copy link
Contributor Author

rathann commented Aug 18, 2023

This fixes run.py ci on 3.12 for me, but it looks like it's still failing the CircleCI tests.

@wbond wbond merged commit 3865f5d into wbond:master Aug 23, 2023
29 checks passed
@rathann rathann deleted the issue74 branch August 23, 2023 11:20
algitbot pushed a commit to alpinelinux/aports that referenced this pull request Jul 10, 2024
While at it, also remove skip-failing-test-due-to-expired-cert.patch as
this test has been fixed upstream.

Patch from: wbond/oscrypto#77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants