Skip to content

Commit

Permalink
test: use import_module instead of pure import
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Sep 13, 2024
1 parent 9e80c6a commit 5f88d12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_optional_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import sys
from importlib import import_module
from unittest.mock import patch

import pytest


# https://stackoverflow.com/a/65034142/1093967
@pytest.mark.parametrize("optional_dependency", ["pandas", "numpy", "pyarrow"])
@pytest.mark.parametrize("optional_dependency", ["numpy", "pandas", "pyarrow"])
def test_without_dependency(optional_dependency):
with patch.dict(sys.modules, {optional_dependency: None}):
assert "ibis_ml" not in sys.modules
import ibis_ml # noqa: F401
import_module("ibis_ml")

0 comments on commit 5f88d12

Please sign in to comment.