diff --git a/cibuildwheel/docker_container.py b/cibuildwheel/docker_container.py index 3131c782..837c06c1 100644 --- a/cibuildwheel/docker_container.py +++ b/cibuildwheel/docker_container.py @@ -1,4 +1,3 @@ -import codecs import io import json import shlex @@ -7,7 +6,7 @@ import sys import uuid from os import PathLike from pathlib import Path, PurePath -from typing import IO, Any, Dict, List, Optional, Sequence, TextIO, Union, cast +from typing import IO, Dict, List, Optional, Sequence, Union class DockerContainer: diff --git a/unit_test/docker_container_test.py b/unit_test/docker_container_test.py index e8ddc7d1..d66155ef 100644 --- a/unit_test/docker_container_test.py +++ b/unit_test/docker_container_test.py @@ -1,29 +1,33 @@ -import pytest -from cibuildwheel.docker_container import DockerContainer import subprocess -import time import textwrap +import pytest + +from cibuildwheel.docker_container import DockerContainer + DEFAULT_IMAGE = 'centos:6' + @pytest.mark.slow def test_simple(): with DockerContainer(DEFAULT_IMAGE) as container: assert container.call(['echo', 'hello'], capture_output=True) == 'hello\n' + @pytest.mark.slow def test_no_lf(): with DockerContainer(DEFAULT_IMAGE) as container: assert container.call(['printf', 'hello'], capture_output=True) == 'hello' + @pytest.mark.slow def test_environment(): with DockerContainer(DEFAULT_IMAGE) as container: assert container.call(['sh', '-c', 'echo $TEST_VAR'], env={'TEST_VAR': '1'}, capture_output=True) == '1\n' + @pytest.mark.slow def test_container_removed(): - start_time = time.time() with DockerContainer(DEFAULT_IMAGE) as container: container.call(['true']) docker_containers_listing = subprocess.run('docker container ls', shell=True, check=True, capture_output=True, universal_newlines=True).stdout @@ -33,6 +37,7 @@ def test_container_removed(): docker_containers_listing = subprocess.run('docker container ls', shell=True, check=True, capture_output=True, universal_newlines=True).stdout assert old_container_name not in docker_containers_listing + @pytest.mark.slow def test_large_environment(): # max environment variable size is 128kB @@ -48,6 +53,7 @@ def test_large_environment(): # check the length of d assert container.call(['sh', '-c', 'echo ${#d}'], env=large_environment, capture_output=True) == f'{long_env_var_length}\n' + @pytest.mark.slow def test_binary_output(): with DockerContainer(DEFAULT_IMAGE) as container: @@ -81,5 +87,3 @@ def test_binary_output(): capture_output=True, ) assert output == binary_data_string - -