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

tools: fix Python 3 deprecation warning in test.py #30208

Closed

Conversation

@Hellzed
Copy link
Contributor

Hellzed commented Nov 1, 2019

Since Python 3.4, the imp module is deprecated, causing a deprecation warning when running tools/test.py.

This fixes it by conditionally using importlib instead when running tools/test.py with Python 3.5+.

Notes:

  • Python 3 < 3.5 is not supported, since importlib.util.module_from_spec() isn't available. Python 3 < 3.5 reached EOL so this should not be an issue.
  • the use of a importlib.machinery.FileFinder should match the the behaviour of imp.find_module() and find any Python-recognised module file (like testcfg.py).
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
@cclauss
cclauss approved these changes Nov 1, 2019
Copy link
Contributor

cclauss left a comment

Beautiful! Thanks much.

@targos
targos approved these changes Nov 1, 2019
Copy link
Member

targos left a comment

Thanks a lot!

nit: indentation should be two spaces

@targos

This comment has been minimized.

Copy link
Member

targos commented Nov 1, 2019

If you want GitHub to register your contribution, you need to add the email address used for the commit to your account (at https://github.com/settings/emails)

@cclauss cclauss added the Python label Nov 1, 2019
@Hellzed

This comment has been minimized.

Copy link
Contributor Author

Hellzed commented Nov 1, 2019

nit: indentation should be two spaces

fixed!

@nodejs-github-bot

This comment has been minimized.

cclauss added a commit that referenced this pull request Nov 3, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
@cclauss

This comment has been minimized.

Copy link
Contributor

cclauss commented Nov 3, 2019

Thanks @Hellzed for a great first contribution.

Landed in bdee976

@cclauss cclauss closed this Nov 3, 2019
targos added a commit that referenced this pull request Nov 5, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
@targos targos mentioned this pull request Nov 5, 2019
targos added a commit that referenced this pull request Nov 8, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
targos added a commit that referenced this pull request Nov 10, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
targos added a commit that referenced this pull request Nov 10, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
targos added a commit that referenced this pull request Nov 11, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.