From 0ce529d84ca9cf846d2ce6e85b7835591bd2ba2d Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Wed, 25 Sep 2024 10:22:05 +0200 Subject: [PATCH] Fixed import from hazardlib.tests --- openquake/commands/sample.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openquake/commands/sample.py b/openquake/commands/sample.py index 4b2be26ea4ba..9975e79bc926 100644 --- a/openquake/commands/sample.py +++ b/openquake/commands/sample.py @@ -22,7 +22,6 @@ import pandas from openquake.hazardlib import ( valid, nrml, sourceconverter, sourcewriter, logictree) -from openquake.hazardlib.tests.gsim.utils import reduce_gsim_test from openquake.baselib import general @@ -98,6 +97,8 @@ def main(fname, reduction_factor: valid.probability, print('Extracted %d rows out of %d' % (len(arr), len(array))) return elif fname.endswith('_test.py'): + # tests are not installed, so this import cannot stay at top-level + from openquake.hazardlib.tests.gsim.utils import reduce_gsim_test print(reduce_gsim_test(fname, reduction_factor)) return node = nrml.read(fname)