aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Hawson <18214721+GertyP@users.noreply.github.com>2023-07-29 14:47:08 +0100
committerEli Schwartz <eschwartz@archlinux.org>2023-07-31 15:43:28 -0400
commit7c955618dd46c3ea7dc221bdf60354871f17f39d (patch)
treeb78df53cddd0c19e77320c2200173d583926f2ff
parentd4615369ffbfc0f9a769ca1fd3566056cfa5ef81 (diff)
downloadmeson-7c955618dd46c3ea7dc221bdf60354871f17f39d.zip
meson-7c955618dd46c3ea7dc221bdf60354871f17f39d.tar.gz
meson-7c955618dd46c3ea7dc221bdf60354871f17f39d.tar.bz2
Rename variables that clash with pdb commands
By default, pdb assumes that any command run is python code to be evaluated, but only if that code isn't a builtin pdb command. You can force it to be evaluated as python code by prefixing it with `!`. It's handy to simply name a python variable and have its variable be printed. But single letter variables like 's' and 'p' make debugging with pdb commands (i.e. 's'tep, and 'p'rint evaluated expressions) less convenient, and potentially confusing.
-rw-r--r--unittests/allplatformstests.py4
-rw-r--r--unittests/baseplatformtests.py22
2 files changed, 13 insertions, 13 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 5a6e88b..12eafd5 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -1369,8 +1369,8 @@ class AllPlatformTests(BasePlatformTests):
targets = self.introspect('--targets')
# This assumes all of the targets support lto
for t in targets:
- for s in t['target_sources']:
- self.assertTrue(expected.issubset(set(s['parameters'])), f'Incorrect values for {t["name"]}')
+ for src in t['target_sources']:
+ self.assertTrue(expected.issubset(set(src['parameters'])), f'Incorrect values for {t["name"]}')
def test_dist_git(self):
if not shutil.which('git'):
diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py
index 4b16e7d..3008eb7 100644
--- a/unittests/baseplatformtests.py
+++ b/unittests/baseplatformtests.py
@@ -171,22 +171,22 @@ class BasePlatformTests(TestCase):
env = os.environ.copy()
env.update(override_envvars)
- p = subprocess.run(command, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT if stderr else subprocess.PIPE,
- env=env,
- encoding='utf-8',
- text=True, cwd=workdir, timeout=60 * 5)
+ proc = subprocess.run(command, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT if stderr else subprocess.PIPE,
+ env=env,
+ encoding='utf-8',
+ text=True, cwd=workdir, timeout=60 * 5)
print('$', join_args(command))
print('stdout:')
- print(p.stdout)
+ print(proc.stdout)
if not stderr:
print('stderr:')
- print(p.stderr)
- if p.returncode != 0:
- if 'MESON_SKIP_TEST' in p.stdout:
+ print(proc.stderr)
+ if proc.returncode != 0:
+ if 'MESON_SKIP_TEST' in proc.stdout:
raise SkipTest('Project requested skipping.')
- raise subprocess.CalledProcessError(p.returncode, command, output=p.stdout)
- return p.stdout
+ raise subprocess.CalledProcessError(proc.returncode, command, output=proc.stdout)
+ return proc.stdout
def init(self, srcdir, *,
extra_args=None,