File: conftest.py

package info (click to toggle)
python-spython 0.3.13-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 736 kB
  • sloc: python: 3,299; sh: 61; makefile: 28
file content (40 lines) | stat: -rw-r--r-- 1,175 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from glob import glob

import pytest

from spython.main import Client
from spython.utils import get_installdir


@pytest.fixture
def installdir():
    return get_installdir()


@pytest.fixture
def test_data(installdir):  # pylint: disable=redefined-outer-name
    root = os.path.join(installdir, "tests", "testdata")
    dockerFiles = glob(os.path.join(root, "docker2singularity", "*.docker"))
    singularityFiles = glob(os.path.join(root, "singularity2docker", "*.def"))
    return {
        "root": root,
        "d2s": [(file, os.path.splitext(file)[0] + ".def") for file in dockerFiles],
        "s2d": [
            (file, os.path.splitext(file)[0] + ".docker") for file in singularityFiles
        ],
    }


@pytest.fixture(scope="session")
def oras_container(tmp_path_factory):
    folder = tmp_path_factory.mktemp("oras-img")
    return folder, Client.pull(
        "oras://ghcr.io/singularityhub/github-ci:latest", pull_folder=str(folder)
    )


@pytest.fixture(scope="session")
def docker_container(tmp_path_factory):
    folder = tmp_path_factory.mktemp("docker-img")
    return folder, Client.pull("docker://busybox:1.30.1", pull_folder=str(folder))