Skip to content

Commit

Permalink
Add docstring to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akihironitta committed Nov 23, 2020
1 parent d3504e0 commit 37cd8d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/datamodules/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
("KittiDataModule", ["torchvision"]),
])
def test_import(dm_cls, deps):
"""Tests importing when dependencies are not met.
Set the followings in @pytest.mark.parametrize:
dm_cls: class to test importing
deps: packages required for dm_cls
"""
with mock.patch.dict("sys.modules", {pkg: None for pkg in deps}):
dms_module = importlib.import_module("pl_bolts.datamodules")
assert hasattr(dms_module, dm_cls), f"`from pl_bolts.datamodules import {dm_cls}` failed."

0 comments on commit 37cd8d3

Please sign in to comment.