Skip to content

Commit d187d90

Browse files
jbrockmendeljreback
authored andcommitted
skip test if running non-installed (#27810)
1 parent 3e4b196 commit d187d90

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/tests/plotting/test_backend.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ def test_backend_is_correct(monkeypatch):
4646

4747
@td.skip_if_no_mpl
4848
def test_register_entrypoint():
49+
50+
dist = pkg_resources.get_distribution("pandas")
51+
if dist.module_path not in pandas.__file__:
52+
# We are running from a non-installed pandas, and this test is invalid
53+
pytest.skip("Testing a non-installed pandas")
54+
4955
mod = types.ModuleType("my_backend")
5056
mod.plot = lambda *args, **kwargs: 1
5157

5258
backends = pkg_resources.get_entry_map("pandas")
5359
my_entrypoint = pkg_resources.EntryPoint(
54-
"pandas_plotting_backend",
55-
mod.__name__,
56-
dist=pkg_resources.get_distribution("pandas"),
60+
"pandas_plotting_backend", mod.__name__, dist=dist
5761
)
5862
backends["pandas_plotting_backends"]["my_backend"] = my_entrypoint
5963
# TODO: the docs recommend importlib.util.module_from_spec. But this works for now.

0 commit comments

Comments
 (0)