Skip to content

Commit

Permalink
Merge pull request #257 from yarikoptic/bf-metalad-import
Browse files Browse the repository at this point in the history
BF: move check for metalad before import of meta_extract
  • Loading branch information
yarikoptic committed Jan 17, 2024
2 parents ce9fe4e + be5f9e1 commit 330e4e3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions datalad_container/extractors/tests/test_metalad_container.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
import os.path as op
import pytest
import subprocess
import sys
from pathlib import Path
from shutil import which
from unittest.mock import patch

import pytest
from datalad.support.external_versions import (
UnknownVersion,
external_versions,
)
# Early detection before we try to import meta_extract
from datalad.tests.utils_pytest import SkipTest

if not external_versions["datalad_metalad"]:
raise SkipTest("skipping metalad tests")

from datalad.api import (
clone,
Dataset,
clone,
meta_extract,
)
from datalad.cmd import (
StdOutCapture,
WitlessRunner,
)
from datalad.support.exceptions import CommandError
from datalad.support.external_versions import external_versions, UnknownVersion
from datalad.tests.utils_pytest import (
SkipTest,
assert_in,
Expand All @@ -27,9 +36,6 @@
with_tree,
)

if not external_versions["datalad_metalad"]:
raise SkipTest("skipping metalad tests")

from datalad_container.utils import get_container_command

try:
Expand All @@ -38,7 +44,9 @@
raise SkipTest("skipping singularity/apptainer tests")

# Must come after skiptest or imports will not work
from datalad_container.extractors.metalad_container import MetaladContainerInspect
from datalad_container.extractors.metalad_container import (
MetaladContainerInspect,
)


@with_tempfile
Expand Down

0 comments on commit 330e4e3

Please sign in to comment.