зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636209: resolves tests that were incorrectly marked as xfail r=tomprince
When handling bug 1632429, I found some tests that worked on Python 2, but not Python 3. They were marked accordingly as "expected failures". However, my system version of Python is 3.8, while CI (and a non-trivial number of devs, probably) use 3.6. Some of these tests marked as xfail were actually still working on versions of Python until 3.8. The failure of this test was due to a change in default tarfile format. Explicitly setting this format makes the tests pass in all relevant python versions. Differential Revision: https://phabricator.services.mozilla.com/D74337
This commit is contained in:
Родитель
2fee157360
Коммит
2e71833471
|
@ -30,7 +30,10 @@ def create_tar_from_files(fp, files):
|
||||||
|
|
||||||
FUTURE accept a filename argument (or create APIs to write files)
|
FUTURE accept a filename argument (or create APIs to write files)
|
||||||
"""
|
"""
|
||||||
with tarfile.open(name='', mode='w', fileobj=fp, dereference=True) as tf:
|
# The format is explicitly set to tarfile.GNU_FORMAT, because this default format
|
||||||
|
# has been changed in Python 3.8.
|
||||||
|
with tarfile.open(name='', mode='w', fileobj=fp, dereference=True,
|
||||||
|
format=tarfile.GNU_FORMAT) as tf:
|
||||||
for archive_path, f in sorted(files.items()):
|
for archive_path, f in sorted(files.items()):
|
||||||
if not isinstance(f, BaseFile):
|
if not isinstance(f, BaseFile):
|
||||||
f = File(f)
|
f = File(f)
|
||||||
|
|
|
@ -7,12 +7,10 @@ from __future__ import absolute_import, print_function, unicode_literals
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import sys
|
|
||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
import mock
|
import mock
|
||||||
import pytest
|
|
||||||
import taskcluster_urls as liburls
|
import taskcluster_urls as liburls
|
||||||
|
|
||||||
from taskgraph.util import docker
|
from taskgraph.util import docker
|
||||||
|
@ -24,10 +22,6 @@ MODE_STANDARD = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
|
||||||
|
|
||||||
@mock.patch.dict('os.environ', {'TASKCLUSTER_ROOT_URL': liburls.test_root_url()})
|
@mock.patch.dict('os.environ', {'TASKCLUSTER_ROOT_URL': liburls.test_root_url()})
|
||||||
class TestDocker(unittest.TestCase):
|
class TestDocker(unittest.TestCase):
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
sys.version_info >= (3, 0), reason="python3 migration is not complete"
|
|
||||||
)
|
|
||||||
def test_generate_context_hash(self):
|
def test_generate_context_hash(self):
|
||||||
tmpdir = tempfile.mkdtemp()
|
tmpdir = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
@ -81,9 +75,6 @@ class TestDocker(unittest.TestCase):
|
||||||
with MockedOpen(files):
|
with MockedOpen(files):
|
||||||
self.assertEqual(docker.docker_image('myimage', by_tag=True), "mozilla/myimage:1.2.3")
|
self.assertEqual(docker.docker_image('myimage', by_tag=True), "mozilla/myimage:1.2.3")
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
sys.version_info >= (3, 0), reason="python3 migration is not complete"
|
|
||||||
)
|
|
||||||
def test_create_context_tar_basic(self):
|
def test_create_context_tar_basic(self):
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
@ -110,9 +101,6 @@ class TestDocker(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tmp)
|
shutil.rmtree(tmp)
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
sys.version_info >= (3, 0), reason="python3 migration is not complete"
|
|
||||||
)
|
|
||||||
def test_create_context_topsrcdir_files(self):
|
def test_create_context_topsrcdir_files(self):
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
@ -183,9 +171,6 @@ class TestDocker(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tmp)
|
shutil.rmtree(tmp)
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
sys.version_info >= (3, 0), reason="python3 migration is not complete"
|
|
||||||
)
|
|
||||||
def test_create_context_extra_directory(self):
|
def test_create_context_extra_directory(self):
|
||||||
tmp = tempfile.mkdtemp()
|
tmp = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче