Fix visualization with server updates while im here
Also checks for connection to central fractal and skips if not.
@@ -3,6 +3,7 @@ Tests for visualization code
"""
import pytest
+import requests
from . import portal
@@ -16,11 +17,19 @@ using_plotly = pytest.mark.skipif(
_has_ploty is False, reason="Not detecting module 'plotly'. Install package if necessary to enable tests.")
+def live_fractal_or_skip():
+ """Ensure Fractal live connection can be made"""
+ try:
+ return portal.FractalClient()
+ except requests.exceptions.ConnectionError:
+ return pytest.skip("Could no make connection to central Fractal server")
+
+
@pytest.fixture
def S22Fixture():
# Connect to the primary database
- client = portal.FractalClient()
+ client = live_fractal_or_skip()
S22 = client.get_collection("ReactionDataset", "S22")
@@ -66,7 +75,7 @@ def test_plot_dataset_groupby(S22Fixture, kind, groupby):
def TDDSFixture():
# Connect to the primary database
- client = portal.FractalClient()
+ client = live_fractal_or_skip()
TDDs = client.get_collection("TorsionDriveDataset", "OpenFF Fragmenter Phenyl Benchmark")
return (client, TDDs)
@@ -76,7 +85,7 @@ def TDDSFixture():
def test_plot_torsiondrive_dataset(TDDSFixture):
client, ds = TDDSFixture
- ds.visualize("c1ccc(cc1)N-[3, 5, 6, 12]", ["b3lyp", "uff"], units="kJ / mol", return_figure=True)
+ ds.visualize("c1ccc(cc1)N-[3, 5, 6, 12]", ["b3lyp-d3", "uff"], units="kJ / mol", return_figure=True)
ds.visualize(
["c1ccc(cc1)N-[3, 5, 6, 12]", "CCCNc1ccc(cc1)Cl-[1, 4, 9, 8]"], "uff", relative=False, return_figure=True)
@@ -85,4 +94,4 @@ def test_plot_torsiondrive_dataset(TDDSFixture):
def test_plot_torsiondrive_dataset_measured(TDDSFixture):
client, ds = TDDSFixture
- ds.visualize("c1ccc(cc1)N-[3, 5, 6, 12]", "b3lyp", units="kJ / mol", use_measured_angle=True, return_figure=True)
\ No newline at end of file
+ ds.visualize("c1ccc(cc1)N-[3, 5, 6, 12]", "b3lyp-d3", units="kJ / mol", use_measured_angle=True, return_figure=True)
