Skip to content

Commit 8d134d1

Browse files
committed
Skip module not found checks in favor for only running the test in
the ci.
1 parent 586b890 commit 8d134d1

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

test/test_plugins.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ def cleanup(self):
570570
yield
571571
self.unimport_plugins()
572572

573+
@pytest.mark.skipif(
574+
os.environ.get("GITHUB_ACTIONS") != "true",
575+
reason="Requires all dependencies to be installed, "
576+
+ "which we can't guarantee in the local environment.",
577+
)
573578
@pytest.mark.parametrize("plugin_name", get_available_plugins())
574579
def test_import_plugin(self, caplog, plugin_name): #
575580
"""Test that a plugin is importable without an error using the
@@ -581,22 +586,9 @@ def test_import_plugin(self, caplog, plugin_name): #
581586

582587
# Check for warnings, is a bit hacky but we can make full use of the beets
583588
# load_plugins code that way
584-
# We skip ModuleNotFoundError to allow local pytest runs to pass if plugin
585-
# dependencies are not installed e.g. librosa for autobpm
586-
records = []
587-
pattern = r"ModuleNotFoundError: No module named '(.*?)'"
588-
for record in caplog.records:
589-
match = re.search(pattern, str(record))
590-
if match:
591-
module_name = match.group(1)
592-
if not self._is_spec_available(module_name):
593-
# If the module is not found, we skip it
594-
continue
595-
records.append(record)
596-
597-
assert len(records) == 0, (
589+
assert len(caplog.records) == 0, (
598590
f"Plugin '{plugin_name}' has issues during import. ",
599-
records,
591+
caplog.records,
600592
)
601593

602594
def _is_spec_available(self, spec_name):

0 commit comments

Comments
 (0)