forked from quantumlib/Cirq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_test.py
40 lines (34 loc) · 1.2 KB
/
docker_test.py
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
# pylint: disable=wrong-or-nonexistent-copyright-notice
import subprocess
import pathlib
import platform
import pytest
def test_docker_stable():
if platform.system() != 'Linux':
pytest.skip("Unsupported os")
root_folder = pathlib.Path(__file__).parent.parent
buildResult = subprocess.run(
['docker', 'build', '--target', 'cirq_stable', '-t', 'cirq_image', '.'], cwd=root_folder
)
assert buildResult.returncode == 0
result = subprocess.run(
['docker run cirq_image python -c "import cirq; assert cirq.__version__ is not None"'],
cwd=root_folder,
shell=True,
)
assert result.returncode == 0
def test_docker_pre():
if platform.system() != 'Linux':
pytest.skip("Unsupported os")
root_folder = pathlib.Path(__file__).parent.parent
buildResult = subprocess.run(
['docker', 'build', '--target', 'cirq_pre_release', '-t', 'cirq_image_pre', '.'],
cwd=root_folder,
)
assert buildResult.returncode == 0
result = subprocess.run(
['docker run cirq_image_pre python -c "import cirq; assert cirq.__version__ is not None"'],
cwd=root_folder,
shell=True,
)
assert result.returncode == 0