Skip to content

Commit

Permalink
test: update plugins tests to use importlib.metadata directly
Browse files Browse the repository at this point in the history
importlib.metadata.EntryPoint *shouldn't* differ from Python 3.8 onward,
unless there's something missing from the documentation. If this breaks
stuff on older Python releases (I'm on 3.10 locally), we will defer this
change until we drop 3.9 as planned per the code comments.
  • Loading branch information
dgw committed Aug 3, 2023
1 parent c743861 commit 2a6d146
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/plugins/test_plugins_handlers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Tests for the ``sopel.plugins.handlers`` module."""
from __future__ import annotations

import importlib.metadata
import os
import sys

# TODO: use stdlib importlib.metadata when dropping py3.9
import importlib_metadata
import pytest

from sopel.plugins import handlers
Expand Down Expand Up @@ -89,7 +88,7 @@ def test_get_label_entrypoint(plugin_tmpfile):

# load the entry point
try:
entry_point = importlib_metadata.EntryPoint(
entry_point = importlib.metadata.EntryPoint(
'test_plugin', 'file_mod', 'sopel.plugins')
plugin = handlers.EntryPointPlugin(entry_point)
plugin.load()
Expand Down
5 changes: 2 additions & 3 deletions test/test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Test for the ``sopel.plugins`` module."""
from __future__ import annotations

import importlib.metadata
import sys

# TODO: switch to stdlib importlib.metdata when dropping py3.9
import importlib_metadata
import pytest

from sopel import plugins
Expand Down Expand Up @@ -138,7 +137,7 @@ def test_plugin_load_entry_point(tmpdir):

# load the entry point
try:
entry_point = importlib_metadata.EntryPoint(
entry_point = importlib.metadata.EntryPoint(
'test_plugin', 'file_mod', 'sopel.plugins')
plugin = plugins.handlers.EntryPointPlugin(entry_point)
plugin.load()
Expand Down

1 comment on commit 2a6d146

@dgw
Copy link
Member Author

@dgw dgw commented on 2a6d146 Aug 3, 2023

Choose a reason for hiding this comment

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

CI passed for Python 3.8/3.9, so I think @half-duplex was right that backport usage here isn't needed any more.

Please sign in to comment.