Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d201f0a
Add container load scripts for Docker and Podman
ErikDanielsson Aug 8, 2025
e6827ef
[automated] Update CHANGELOG.md
nf-core-bot Aug 8, 2025
1d7f48e
Update tests
ErikDanielsson Aug 8, 2025
488b7b4
Merge branch 'download-refactor-again' into container-load-scripts
ErikDanielsson Aug 13, 2025
510f566
Create download test folder and move util tests
ErikDanielsson Aug 14, 2025
1a765c4
Move singularity and docker tests
ErikDanielsson Aug 14, 2025
29529ca
Move tests from utils to correct class
ErikDanielsson Aug 14, 2025
7dede8a
Update comments
ErikDanielsson Aug 14, 2025
c7495de
Merge branch 'refactor-download-tests' into container-load-scripts
ErikDanielsson Aug 14, 2025
6215f95
Fix typo
ErikDanielsson Aug 14, 2025
fd6a38f
Merge branch 'download-refactor-again' into refactor-download-tests
ErikDanielsson Aug 14, 2025
44cc2b3
Merge branch 'refactor-download-tests' into container-load-scripts
ErikDanielsson Aug 14, 2025
35a2ad1
Merge branch 'download-refactor-again' into refactor-download-tests
ErikDanielsson Aug 14, 2025
ff681f7
Fix test
ErikDanielsson Aug 14, 2025
e662c2c
Merge branch 'download-refactor-again' into refactor-download-tests
ErikDanielsson Aug 14, 2025
3b187b4
Merge branch 'refactor-download-tests' into container-load-scripts
ErikDanielsson Aug 14, 2025
cb318b2
Merge branch 'dev' into container-load-scripts
JulianFlesch Aug 28, 2025
441a5ec
fix: Remove use of 'jq' for REPO_TAG extraction, which may not be ins…
JulianFlesch Aug 28, 2025
7702073
impr: Fail if docker daemon is not running
JulianFlesch Aug 28, 2025
350555a
impr: Fail if no podman installation is found or no podman machine is…
JulianFlesch Aug 28, 2025
239953e
impr: Fail if docker cmd not found
JulianFlesch Aug 28, 2025
1fa9c0d
Merge branch 'dev' into container-load-scripts
JulianFlesch Aug 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update comments
  • Loading branch information
ErikDanielsson committed Aug 14, 2025
commit 7dede8a63978fc997ff9a2c5402ad79abede620f
13 changes: 8 additions & 5 deletions tests/pipelines/download/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def test_docker_progress_pull(self):
assert table.columns[2]._cells[0] == "([blue]Pulling)"


#
# Test the DockerFetcher class
#
class DockerTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def use_caplog(self, caplog):
Expand All @@ -71,7 +74,7 @@ def __contains__(self, item: str) -> bool:
return any(record.message == item for record in self._caplog.records if self._caplog)

#
# Tests for 'DockerFetcher.pull_image'
# Tests for 'pull_image'
#
# If Docker is installed, but the container can't be accessed because it does not exist or there are access
# restrictions, a RuntimeWarning is raised due to the unavailability of the image.
Expand Down Expand Up @@ -119,7 +122,7 @@ def test_docker_pull_image_docker_installed(self, tmp_dir, mock_progress, mock_t
docker_fetcher.pull_image("ghcr.io/ewels/multiqc:go-rewrite", mock_task_obj)

#
# Tests for 'DockerFetcher.pull_and_save_image'
# Tests for 'pull_and_save_image'
#
@pytest.mark.skipif(
shutil.which("docker") is None,
Expand All @@ -138,7 +141,7 @@ def test_docker_pull_image_successfully(self, tmp_dir, mock_progress):
docker_fetcher.pull_and_save_image("hello-world", tmp_dir / "hello-world.tar")

#
# Tests for 'DockerFetcher.save_image'
# Tests for 'save_image'
#
@pytest.mark.skipif(
shutil.which("docker") is None,
Expand All @@ -165,7 +168,7 @@ def test_docker_save_image(self, tmp_dir, mock_progress, mock_task):

#
#
# Tests for 'DockerFetcher.fetch_containers'
# Tests for 'fetch_containers': this will test fetch remote containers automatically
#
@pytest.mark.skipif(
shutil.which("singularity") is None and shutil.which("apptainer") is None,
Expand Down Expand Up @@ -199,7 +202,7 @@ def test_fetch_containers_docker(self, tmp_path, mock_fetch_wf_config):
)

#
# Test for DockerFetcher.write_docker_load_command
# Test for 'write_docker_load_command'
#
def test_docker_write_docker_load_message(self):
docker_fetcher = DockerFetcher(
Expand Down
6 changes: 2 additions & 4 deletions tests/pipelines/download/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ def test_wf_use_local_configs(self, tmp_path):
assert wf_config["params.custom_config_base"] == f"{test_outdir}/workflow/../configs/"

#
# Test that `find_container_images` (uses `nextflow inspect`) and `find_container_images_legacy`
# produces the same results
# Test that `find_container_images` (uses `nextflow inspect`) fetches the correct Docker images
#
@pytest.mark.skipif(
shutil.which("nextflow") is None or not check_nextflow_version(NF_INSPECT_MIN_NF_VERSION),
Expand Down Expand Up @@ -242,8 +241,7 @@ def test_containers_pipeline_singularity(self, tmp_path, mock_fetch_wf_config):
)

#
# Test that `find_container_images` (uses `nextflow inspect`) and `find_container_images_legacy`
# produces the same results
# Test that `find_container_images` (uses `nextflow inspect`) fetches the correct Docker images
#
@pytest.mark.skipif(
shutil.which("nextflow") is None or not check_nextflow_version(NF_INSPECT_MIN_NF_VERSION),
Expand Down
30 changes: 18 additions & 12 deletions tests/pipelines/download/test_singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def test_singularity_download_progress(self):
assert table.columns[6]._cells[0]._text == ["?"]


#
# Test the SingularityFetcher class
#
class SingularityTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def use_caplog(self, caplog):
Expand Down Expand Up @@ -201,7 +204,7 @@ def test_singularity_pull_image_singularity_installed(self, tmp_dir, mock_progre

#
#
# Tests for 'SingularityFetcher.fetch_containers'
# Tests for 'fetch_containers': this will test fetch remote containers automatically
#
@pytest.mark.skipif(
shutil.which("singularity") is None and shutil.which("apptainer") is None,
Expand Down Expand Up @@ -238,7 +241,7 @@ def test_fetch_containers_singularity(self, tmp_path, mock_fetch_wf_config):
)

#
# Tests for 'singularity.symlink_registries' function
# Tests for the 'symlink_registries' function
#

# Simple file name with no registry in it
Expand Down Expand Up @@ -390,7 +393,7 @@ def test_symlink_singularity_symlink_registries(
mock_open.assert_called_once_with(tmp_path / "path/to", os.O_RDONLY)

#
# Tests for 'SingularityFetcher.pull_image'
# Tests for 'pull_image'
#
@pytest.mark.skipif(
shutil.which("singularity") is None and shutil.which("apptainer") is None,
Expand Down Expand Up @@ -470,7 +473,7 @@ def test_singularity_pull_image_singularity_not_installed(self, tmp_dir, mock_ri
fetcher.check_and_set_implementation()

#
# Test for 'singularity.get_container_filename' function
# Test for 'get_container_filename' function
#

@mock.patch("nf_core.pipelines.download.singularity.SingularityFetcher.check_and_set_implementation")
Expand Down Expand Up @@ -586,8 +589,17 @@ def test_remote_container_functionality(self, tmp_dir):
assert "depot.galaxyproject.org-singularity-salmon-1.5.2--h84f40af_0.img" in containers_remote
assert "MV Rena" not in containers_remote # decoy in test file


#
# Tests for the FileDownloader class
#
class FileDownloaderTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def use_caplog(self, caplog):
self._caplog = caplog

#
# Test for 'singularity.FileDownloader.download_file'
# Test for 'download_file'
#
@with_temporary_folder
def test_file_download(self, outdir):
Expand Down Expand Up @@ -659,14 +671,8 @@ def test_file_download(self, outdir):
downloader.download_file(src_url, output_path)
assert not (output_path).exists()


class FileDownloaderTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def use_caplog(self, caplog):
self._caplog = caplog

#
# Test for 'singularity.FileDownloader.download_files_in_parallel'
# Test for 'download_files_in_parallel'
#
@with_temporary_folder
def test_parallel_downloads(self, outdir):
Expand Down
Loading