Skip to content

Commit ba81cb7

Browse files
committed
skip tests that currently only work on Linux
1 parent 8ad39d9 commit ba81cb7

File tree

8 files changed

+60
-0
lines changed

8 files changed

+60
-0
lines changed

test/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import platform
23
from pathlib import Path
34

45
import pytest
@@ -16,6 +17,11 @@
1617
# no way to ignore ~/.gitconfig other than overriding $HOME, which is overkill.
1718
os.environ["GIT_CONFIG_NOSYSTEM"] = "1"
1819

20+
# Some of the tests marked with this may be fixable on Windows; we should
21+
# look into these in more depth at some point.
22+
nowin = pytest.mark.skipif(
23+
platform.system() == "Windows", reason="test currently broken on Windows"
24+
)
1925

2026
@pytest.fixture
2127
def responses():

test/test_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
from taskgraph.config import GraphConfig
1212

13+
from .conftest import nowin
14+
1315

1416
def test_graph_config_basic():
1517
graph_config = GraphConfig({"foo": "bar"}, "root")
@@ -50,6 +52,7 @@ def test_vcs_root_with_non_standard_dir():
5052
assert vcs_root == expected_path
5153

5254

55+
@nowin
5356
def test_vcs_root_fallback(mocker):
5457
mocker.patch("os.getcwd", return_value="/path/to/repo")
5558

test/test_docker.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from taskgraph.transforms.docker_image import IMAGE_BUILDER_IMAGE
1111
from taskgraph.util.vcs import get_repository
1212

13+
from .conftest import nowin
14+
1315

1416
@pytest.fixture
1517
def root_url():
@@ -112,6 +114,7 @@ def test_load_task_invalid_task(run_load_task):
112114
assert run_load_task(task)[0] == 1
113115

114116

117+
@nowin
115118
def test_load_task(run_load_task):
116119
image_task_id = "def"
117120
task = {
@@ -172,6 +175,7 @@ def test_load_task(run_load_task):
172175
assert exp == actual[i]
173176

174177

178+
@nowin
175179
def test_load_task_env_init_and_remove(mocker, run_load_task):
176180
# Mock NamedTemporaryFile to capture what's written to it
177181
mock_envfile = mocker.MagicMock()
@@ -252,6 +256,7 @@ def test_load_task_env_init_and_remove(mocker, run_load_task):
252256
assert actual[6:8] == ["-v", "/tmp/test_initfile:/builds/worker/.bashrc"]
253257

254258

259+
@nowin
255260
@pytest.mark.parametrize(
256261
"image",
257262
[
@@ -292,6 +297,7 @@ def test_load_task_with_different_image_types(
292297
mocks["load_image_by_task_id"].assert_called_once_with(image_task_id)
293298

294299

300+
@nowin
295301
def test_load_task_with_local_image(
296302
mocker,
297303
run_load_task,
@@ -322,6 +328,7 @@ def test_load_task_with_local_image(
322328
assert mocks["build_image"].call_args[0][1] == "hello-world"
323329

324330

331+
@nowin
325332
def test_load_task_with_unsupported_image_type(caplog, run_load_task):
326333
caplog.set_level(logging.DEBUG)
327334
task = {
@@ -343,6 +350,7 @@ def test_load_task_with_unsupported_image_type(caplog, run_load_task):
343350
assert "Tasks with unsupported-type images are not supported!" in caplog.text
344351

345352

353+
@nowin
346354
def test_load_task_with_task_definition(run_load_task, caplog):
347355
# Test passing a task definition directly instead of a task ID
348356
caplog.set_level(logging.INFO)
@@ -372,6 +380,7 @@ def test_load_task_with_task_definition(run_load_task, caplog):
372380
assert "Loading 'test-task-direct' from provided definition" in caplog.text
373381

374382

383+
@nowin
375384
def test_load_task_with_interactive_false(run_load_task):
376385
# Test non-interactive mode that doesn't require run-task
377386
# Task that doesn't use run-task (would fail in interactive mode)
@@ -427,6 +436,7 @@ def task():
427436
}
428437

429438

439+
@nowin
430440
def test_load_task_with_custom_image_in_tree(run_load_task, task):
431441
image = "hello-world"
432442
ret, mocks = run_load_task(task, custom_image=image)
@@ -453,13 +463,15 @@ def test_load_task_with_custom_image_in_tree(run_load_task, task):
453463
assert tag == f"taskcluster/{image}:latest"
454464

455465

466+
@nowin
456467
def test_load_task_with_custom_image_task_id(run_load_task, task):
457468
image = "task-id=abc"
458469
ret, mocks = run_load_task(task, custom_image=image)
459470
assert ret == 0
460471
mocks["load_image_by_task_id"].assert_called_once_with("abc")
461472

462473

474+
@nowin
463475
def test_load_task_with_custom_image_index(mocker, run_load_task, task):
464476
image = "index=abc"
465477
mocker.patch.object(docker, "find_task_id", return_value="abc")
@@ -468,6 +480,7 @@ def test_load_task_with_custom_image_index(mocker, run_load_task, task):
468480
mocks["load_image_by_task_id"].assert_called_once_with("abc")
469481

470482

483+
@nowin
471484
def test_load_task_with_custom_image_registry(mocker, run_load_task, task):
472485
image = "ubuntu:latest"
473486
ret, mocks = run_load_task(task, custom_image=image)
@@ -476,6 +489,7 @@ def test_load_task_with_custom_image_registry(mocker, run_load_task, task):
476489
assert not mocks["build_image"].called
477490

478491

492+
@nowin
479493
def test_load_task_with_develop(mocker, run_load_task, task):
480494
repo_name = "foo"
481495
repo_path = "/workdir/vcs"
@@ -623,6 +637,7 @@ def mock_path_constructor(path_arg):
623637
return inner
624638

625639

640+
@nowin
626641
def test_build_image(run_build_image):
627642
# Test building image without save_image
628643
result, mocks = run_build_image("hello-world")
@@ -654,6 +669,7 @@ def test_build_image(run_build_image):
654669
assert result == "hello-world:latest"
655670

656671

672+
@nowin
657673
def test_build_image_with_parent(mocker, responses, root_url, run_build_image):
658674
parent_task_id = "abc"
659675
responses.get(f"{root_url}/api/queue/v1/task/{parent_task_id}/status")
@@ -687,6 +703,7 @@ def test_build_image_with_parent(mocker, responses, root_url, run_build_image):
687703
assert docker_load_args[:3] == ["docker", "load", "-i"]
688704

689705

706+
@nowin
690707
def test_build_image_with_parent_not_found(
691708
mocker, responses, root_url, run_build_image
692709
):
@@ -725,6 +742,7 @@ def test_build_image_with_parent_not_found(
725742
assert docker_load_args[:3] == ["docker", "load", "-i"]
726743

727744

745+
@nowin
728746
def test_build_image_with_save_image(run_build_image):
729747
save_path = "/path/to/save.tar"
730748

@@ -741,6 +759,7 @@ def test_build_image_with_save_image(run_build_image):
741759
assert save_path in str(result)
742760

743761

762+
@nowin
744763
def test_build_image_context_only(run_build_image):
745764
context_path = "/path/to/context.tar"
746765

test/test_scripts_run_task.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import taskgraph
1616
from taskgraph.util.caches import CACHES
1717

18+
from .conftest import nowin
19+
1820

1921
@pytest.fixture(scope="module")
2022
def run_task_mod():
@@ -617,6 +619,7 @@ def inner(extra_args=None, env=None):
617619
return inner
618620

619621

622+
@nowin
620623
def test_main_abspath_environment(mocker, run_main):
621624
envvars = ["GECKO_PATH", "MOZ_FETCHES_DIR", "UPLOAD_DIR"]
622625
envvars += [cache["env"] for cache in CACHES.values() if "env" in cache]

test/test_transforms_run_toolchain.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from taskgraph.util.templates import merge
1212
from taskgraph.util.vcs import GitRepository
1313

14+
from .conftest import nowin
15+
1416
TASK_DEFAULTS = {
1517
"description": "fake description",
1618
"label": "fake-task-label",
@@ -205,6 +207,7 @@ def assert_relative_script(task, taskdesc):
205207
assert_docker_worker(task, taskdesc)
206208

207209

210+
@nowin
208211
@pytest.mark.parametrize(
209212
"task",
210213
(

test/test_util_archive.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
create_tar_gz_from_files,
1616
)
1717

18+
from .conftest import nowin
19+
1820
MODE_STANDARD = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
1921

2022

@@ -72,6 +74,7 @@ def test_dirs_refused(tmp_path):
7274
create_tar_from_files(fh, {"test": str(tmp_path)})
7375

7476

77+
@nowin
7578
def test_setuid_setgid_refused(tmp_path):
7679
uid = tmp_path / "setuid"
7780
uid.touch()
@@ -89,6 +92,7 @@ def test_setuid_setgid_refused(tmp_path):
8992
create_tar_from_files(fh, {"test": str(gid)})
9093

9194

95+
@nowin
9296
def test_create_tar_basic(tmp_path, create_files):
9397
files = create_files()
9498

@@ -103,6 +107,7 @@ def test_create_tar_basic(tmp_path, create_files):
103107
verify_basic_tarfile(tf)
104108

105109

110+
@nowin
106111
def test_executable_preserved(tmp_path):
107112
p = tmp_path / "exec"
108113
p.write_bytes(b"#!/bin/bash\n")
@@ -129,6 +134,7 @@ def test_executable_preserved(tmp_path):
129134
assert extracted_content == b"#!/bin/bash\n"
130135

131136

137+
@nowin
132138
def test_create_tar_gz_basic(tmp_path, create_files):
133139
gp = tmp_path / "test.tar.gz"
134140
with open(gp, "wb") as fh:
@@ -156,6 +162,7 @@ def test_create_tar_gz_basic(tmp_path, create_files):
156162
verify_basic_tarfile(tf)
157163

158164

165+
@nowin
159166
def test_tar_gz_name(tmp_path, create_files):
160167
gp = tmp_path / "test.tar.gz"
161168
with open(gp, "wb") as fh:

test/test_util_docker.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
from taskgraph.config import GraphConfig
1818
from taskgraph.util import docker
1919

20+
from .conftest import nowin
2021
from .mockedopen import MockedOpen
2122

2223
MODE_STANDARD = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
2324

2425

2526
@mock.patch.dict("os.environ", {"TASKCLUSTER_ROOT_URL": liburls.test_root_url()})
2627
class TestDocker(unittest.TestCase):
28+
@nowin
2729
def test_generate_context_hash(self):
2830
tmpdir = tempfile.mkdtemp()
2931
try:
@@ -45,6 +47,7 @@ def test_generate_context_hash(self):
4547
finally:
4648
shutil.rmtree(tmpdir)
4749

50+
@nowin
4851
def test_docker_image_explicit_registry(self):
4952
files = {}
5053
files[f"{docker.IMAGE_DIR}/myimage/REGISTRY"] = "cool-images"
@@ -55,6 +58,7 @@ def test_docker_image_explicit_registry(self):
5558
docker.docker_image("myimage"), "cool-images/myimage@sha256:434..."
5659
)
5760

61+
@nowin
5862
def test_docker_image_explicit_registry_by_tag(self):
5963
files = {}
6064
files[f"{docker.IMAGE_DIR}/myimage/REGISTRY"] = "myreg"
@@ -65,6 +69,7 @@ def test_docker_image_explicit_registry_by_tag(self):
6569
docker.docker_image("myimage", by_tag=True), "myreg/myimage:1.2.3"
6670
)
6771

72+
@nowin
6873
def test_docker_image_default_registry(self):
6974
files = {}
7075
files[f"{docker.IMAGE_DIR}/REGISTRY"] = "mozilla"
@@ -75,6 +80,7 @@ def test_docker_image_default_registry(self):
7580
docker.docker_image("myimage"), "mozilla/myimage@sha256:434..."
7681
)
7782

83+
@nowin
7884
def test_docker_image_default_registry_by_tag(self):
7985
files = {}
8086
files[f"{docker.IMAGE_DIR}/REGISTRY"] = "mozilla"
@@ -85,6 +91,7 @@ def test_docker_image_default_registry_by_tag(self):
8591
docker.docker_image("myimage", by_tag=True), "mozilla/myimage:1.2.3"
8692
)
8793

94+
@nowin
8895
def test_create_context_tar_basic(self):
8996
tmp = tempfile.mkdtemp()
9097
try:
@@ -116,6 +123,7 @@ def test_create_context_tar_basic(self):
116123
finally:
117124
shutil.rmtree(tmp)
118125

126+
@nowin
119127
def test_create_context_topsrcdir_files(self):
120128
tmp = tempfile.mkdtemp()
121129
try:
@@ -148,6 +156,7 @@ def test_create_context_topsrcdir_files(self):
148156
finally:
149157
shutil.rmtree(tmp)
150158

159+
@nowin
151160
def test_create_context_absolute_path(self):
152161
tmp = tempfile.mkdtemp()
153162
try:
@@ -163,6 +172,7 @@ def test_create_context_absolute_path(self):
163172
finally:
164173
shutil.rmtree(tmp)
165174

175+
@nowin
166176
def test_create_context_outside_topsrcdir(self):
167177
tmp = tempfile.mkdtemp()
168178
try:
@@ -177,6 +187,7 @@ def test_create_context_outside_topsrcdir(self):
177187
finally:
178188
shutil.rmtree(tmp)
179189

190+
@nowin
180191
def test_create_context_missing_extra(self):
181192
tmp = tempfile.mkdtemp()
182193
try:
@@ -191,6 +202,7 @@ def test_create_context_missing_extra(self):
191202
finally:
192203
shutil.rmtree(tmp)
193204

205+
@nowin
194206
def test_create_context_extra_directory(self):
195207
tmp = tempfile.mkdtemp()
196208
try:
@@ -235,6 +247,7 @@ def test_create_context_extra_directory(self):
235247
finally:
236248
shutil.rmtree(tmp)
237249

250+
@nowin
238251
def test_stream_context_tar(self):
239252
tmp = tempfile.mkdtemp()
240253
try:
@@ -271,6 +284,7 @@ def test_stream_context_tar(self):
271284
finally:
272285
shutil.rmtree(tmp)
273286

287+
@nowin
274288
def test_image_paths_with_custom_kind(self):
275289
"""Test image_paths function with graph_config parameter."""
276290
temp_dir = tempfile.mkdtemp()
@@ -309,6 +323,7 @@ def test_image_paths_with_custom_kind(self):
309323
finally:
310324
shutil.rmtree(temp_dir)
311325

326+
@nowin
312327
def test_parse_volumes_with_graph_config(self):
313328
"""Test parse_volumes function with graph_config parameter."""
314329
temp_dir = tempfile.mkdtemp()

0 commit comments

Comments
 (0)