Skip to content

Commit

Permalink
Reverse import order
Browse files Browse the repository at this point in the history
Try importing the new package names before importing the
deprecated, avoiding a potential deprecation warning in case
a compatibility package is installed.
  • Loading branch information
berland authored and sondreso committed Sep 20, 2022
1 parent c57858b commit 25d16d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/xtgeoapp_grd3dmaps/hook_implementations/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from pkg_resources import resource_filename

try:
from ert_shared.plugins.plugin_manager import hook_implementation
from ert_shared.plugins.plugin_response import plugin_response
except ModuleNotFoundError:
from ert.shared.plugins.plugin_manager import hook_implementation
from ert.shared.plugins.plugin_response import plugin_response
except ModuleNotFoundError:
from ert_shared.plugins.plugin_manager import hook_implementation
from ert_shared.plugins.plugin_response import plugin_response

PLUGIN_NAME = "xtgeoapp_grd3dmaps"

Expand Down
9 changes: 5 additions & 4 deletions tests/test_vs_ert/test_hook_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
import pytest

try:
import ert_shared # noqa
import ert # noqa
except ImportError:
try:
import ert # noqa
import ert_shared # noqa
except ImportError:
pytest.skip(
"Not testing ERT hooks when ERT is not installed", allow_module_level=True
)

import xtgeoapp_grd3dmaps.hook_implementations.jobs as jobs

try:
from ert_shared.plugins.plugin_manager import ErtPluginManager
except ModuleNotFoundError:
from ert.shared.plugins.plugin_manager import ErtPluginManager
except ModuleNotFoundError:
from ert_shared.plugins.plugin_manager import ErtPluginManager

EXPECTED_JOBS = {
"GRID3D_AVERAGE_MAP": "xtgeoapp_grd3dmaps/config_jobs/GRID3D_AVERAGE_MAP",
Expand Down

0 comments on commit 25d16d9

Please sign in to comment.