From 00f5f9749967edf4d0bc261a4a6cbfdf34305860 Mon Sep 17 00:00:00 2001 From: Timotej Bernat Date: Mon, 2 Dec 2024 21:00:48 -0700 Subject: [PATCH] Inverted import order to cause OpenFF installation error to raise prior to direct openff.toolkit imports --- .../mdtools/openfftools/partialcharge/test_molchargers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/polymerist/tests/mdtools/openfftools/partialcharge/test_molchargers.py b/polymerist/tests/mdtools/openfftools/partialcharge/test_molchargers.py index 3b43d78..eb291f2 100644 --- a/polymerist/tests/mdtools/openfftools/partialcharge/test_molchargers.py +++ b/polymerist/tests/mdtools/openfftools/partialcharge/test_molchargers.py @@ -5,13 +5,15 @@ import pytest -from openff.toolkit import Molecule -from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE - +# NOTE: inverted custom imports here to get polymerist.openfftools import first, +# Done so that if OpenFF is not found, a helpful installation error with be raised prior to attempting direct openff.toolkit imports below from polymerist.genutils.importutils.dependencies import modules_installed from polymerist.mdtools.openfftools.partialcharge.molchargers import MolCharger, ABE10Charger, EspalomaCharger, NAGLCharger from polymerist.mdtools.openfftools.partialcharge.rescharge.interface import LibraryCharger +from openff.toolkit import Molecule +from openff.toolkit.utils.toolkits import OPENEYE_AVAILABLE + # Test MolCharger subclass registration def test_molcharger_registers_subclasses() -> None: