Fix style
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import codecs
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
import shlex
|
import shlex
|
||||||
@@ -7,7 +6,7 @@ import sys
|
|||||||
import uuid
|
import uuid
|
||||||
from os import PathLike
|
from os import PathLike
|
||||||
from pathlib import Path, PurePath
|
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:
|
class DockerContainer:
|
||||||
|
|||||||
@@ -1,29 +1,33 @@
|
|||||||
import pytest
|
|
||||||
from cibuildwheel.docker_container import DockerContainer
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from cibuildwheel.docker_container import DockerContainer
|
||||||
|
|
||||||
DEFAULT_IMAGE = 'centos:6'
|
DEFAULT_IMAGE = 'centos:6'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_simple():
|
def test_simple():
|
||||||
with DockerContainer(DEFAULT_IMAGE) as container:
|
with DockerContainer(DEFAULT_IMAGE) as container:
|
||||||
assert container.call(['echo', 'hello'], capture_output=True) == 'hello\n'
|
assert container.call(['echo', 'hello'], capture_output=True) == 'hello\n'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_no_lf():
|
def test_no_lf():
|
||||||
with DockerContainer(DEFAULT_IMAGE) as container:
|
with DockerContainer(DEFAULT_IMAGE) as container:
|
||||||
assert container.call(['printf', 'hello'], capture_output=True) == 'hello'
|
assert container.call(['printf', 'hello'], capture_output=True) == 'hello'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_environment():
|
def test_environment():
|
||||||
with DockerContainer(DEFAULT_IMAGE) as container:
|
with DockerContainer(DEFAULT_IMAGE) as container:
|
||||||
assert container.call(['sh', '-c', 'echo $TEST_VAR'], env={'TEST_VAR': '1'}, capture_output=True) == '1\n'
|
assert container.call(['sh', '-c', 'echo $TEST_VAR'], env={'TEST_VAR': '1'}, capture_output=True) == '1\n'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_container_removed():
|
def test_container_removed():
|
||||||
start_time = time.time()
|
|
||||||
with DockerContainer(DEFAULT_IMAGE) as container:
|
with DockerContainer(DEFAULT_IMAGE) as container:
|
||||||
container.call(['true'])
|
container.call(['true'])
|
||||||
docker_containers_listing = subprocess.run('docker container ls', shell=True, check=True, capture_output=True, universal_newlines=True).stdout
|
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
|
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
|
assert old_container_name not in docker_containers_listing
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_large_environment():
|
def test_large_environment():
|
||||||
# max environment variable size is 128kB
|
# max environment variable size is 128kB
|
||||||
@@ -48,6 +53,7 @@ def test_large_environment():
|
|||||||
# check the length of d
|
# check the length of d
|
||||||
assert container.call(['sh', '-c', 'echo ${#d}'], env=large_environment, capture_output=True) == f'{long_env_var_length}\n'
|
assert container.call(['sh', '-c', 'echo ${#d}'], env=large_environment, capture_output=True) == f'{long_env_var_length}\n'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.slow
|
@pytest.mark.slow
|
||||||
def test_binary_output():
|
def test_binary_output():
|
||||||
with DockerContainer(DEFAULT_IMAGE) as container:
|
with DockerContainer(DEFAULT_IMAGE) as container:
|
||||||
@@ -81,5 +87,3 @@ def test_binary_output():
|
|||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
assert output == binary_data_string
|
assert output == binary_data_string
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user