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 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

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Nov 1, 2019
Copy link
Contributor

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Beautiful! Thanks much.

Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

nit: indentation should be two spaces

@targos
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 PRs and issues that require attention from people who are familiar with Python. label Nov 1, 2019
@Hellzed
Copy link
Contributor Author

Hellzed commented Nov 1, 2019

nit: indentation should be two spaces

fixed!

@nodejs-github-bot
Copy link
Collaborator

cclauss pushed a commit that referenced this pull request Nov 3, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
@cclauss
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 pushed a commit that referenced this pull request Nov 5, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
@targos targos mentioned this pull request Nov 5, 2019
targos pushed a commit that referenced this pull request Nov 8, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
targos pushed a commit that referenced this pull request Nov 10, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
targos pushed a commit that referenced this pull request Nov 10, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
targos pushed a commit that referenced this pull request Nov 11, 2019
PR-URL: #30208
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python PRs and issues that require attention from people who are familiar with Python. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants