Skip to content

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed
 

‎src/bootstrap/bootstrap.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ def __init__(self):
472472

473473
class RustBuild(object):
474474
"""Provide all the methods required to build Rust"""
475-
def __init__(self, config_toml="", args=FakeArgs()):
475+
def __init__(self, config_toml="", args=None):
476+
if args is None:
477+
args = FakeArgs()
476478
self.git_version = None
477479
self.nix_deps_dir = None
478480
self._should_fix_bins_and_dylibs = None

‎src/bootstrap/bootstrap_test.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from __future__ import absolute_import, division, print_function
66
import os
7-
import doctest
87
import unittest
98
import tempfile
109
import hashlib
@@ -16,12 +15,15 @@
1615
bootstrap_dir = os.path.dirname(os.path.abspath(__file__))
1716
# For the import below, have Python search in src/bootstrap first.
1817
sys.path.insert(0, bootstrap_dir)
19-
import bootstrap
20-
import configure
18+
import bootstrap # noqa: E402
19+
import configure # noqa: E402
2120

22-
def serialize_and_parse(configure_args, bootstrap_args=bootstrap.FakeArgs()):
21+
def serialize_and_parse(configure_args, bootstrap_args=None):
2322
from io import StringIO
2423

24+
if bootstrap_args is None:
25+
bootstrap_args = bootstrap.FakeArgs()
26+
2527
section_order, sections, targets = configure.parse_args(configure_args)
2628
buffer = StringIO()
2729
configure.write_config_toml(buffer, section_order, targets, sections)
@@ -129,7 +131,14 @@ def test_set_codegen_backends(self):
129131
class BuildBootstrap(unittest.TestCase):
130132
"""Test that we generate the appropriate arguments when building bootstrap"""
131133

132-
def build_args(self, configure_args=[], args=[], env={}):
134+
def build_args(self, configure_args=None, args=None, env=None):
135+
if configure_args is None:
136+
configure_args = []
137+
if args is None:
138+
args = []
139+
if env is None:
140+
env = {}
141+
133142
env = env.copy()
134143
env["PATH"] = os.environ["PATH"]
135144

‎src/ci/docker/scripts/fuchsia-test-runner.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
import json
1616
import os
1717
import platform
18-
import re
1918
import shutil
20-
import signal
2119
import subprocess
2220
import sys
23-
from typing import ClassVar, List, Optional
21+
from typing import ClassVar, List
2422

2523

2624
@dataclass
@@ -523,7 +521,7 @@ def log(msg):
523521
env_vars += '\n "RUST_BACKTRACE=0",'
524522

525523
# Use /tmp as the test temporary directory
526-
env_vars += f'\n "RUST_TEST_TMPDIR=/tmp",'
524+
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
527525

528526
cml.write(
529527
self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)

‎x.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
4141
This message can be suppressed by setting `RUST_IGNORE_OLD_PYTHON=1`
4242
""".format(major, minor))
43-
warnings.warn(msg)
43+
warnings.warn(msg, stacklevel=1)
4444

4545
rust_dir = os.path.dirname(os.path.abspath(__file__))
4646
# For the import below, have Python search in src/bootstrap first.

0 commit comments

Comments
 (0)
Please sign in to comment.