Skip to content

Commit

Permalink
fix: revert approach for testing removal of module
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Sep 13, 2024
1 parent 5f88d12 commit 6c7f9f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_optional_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import sys
from importlib import import_module
from importlib import import_module, reload
from unittest.mock import patch

import pytest


# https://stackoverflow.com/a/65034142/1093967
# https://stackoverflow.com/a/65163627
@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_module("ibis_ml")
if "ibis_ml" in sys.modules:
reload(sys.modules["ibis_ml"])
else:
import_module("ibis_ml")

0 comments on commit 6c7f9f1

Please sign in to comment.