summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-07-28 13:37:35 -0400
committerEli Schwartz <eschwartz93@gmail.com>2024-07-30 14:13:12 -0400
commit077d540c10a103fd5a41d0747b8140fef87b02ef (patch)
tree731978e5e407011fee278da2f848617b6958652d
parent28ab1ce39a7889c681cf6874f9062baa97b1f5f7 (diff)
downloadmeson-077d540c10a103fd5a41d0747b8140fef87b02ef.tar.gz
unittests: fix EncodingWarnings. minus 123 warnings collected by pytest
-rw-r--r--unittests/baseplatformtests.py4
-rw-r--r--unittests/helpers.py2
-rw-r--r--unittests/linuxliketests.py2
-rw-r--r--unittests/machinefiletests.py2
-rw-r--r--unittests/rewritetests.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py
index 6e6a01d40..597633514 100644
--- a/unittests/baseplatformtests.py
+++ b/unittests/baseplatformtests.py
@@ -364,14 +364,14 @@ class BasePlatformTests(TestCase):
if isinstance(args, str):
args = [args]
out = subprocess.check_output(self.mintro_command + args + [self.builddir],
- universal_newlines=True)
+ encoding='utf-8', universal_newlines=True)
return json.loads(out)
def introspect_directory(self, directory, args):
if isinstance(args, str):
args = [args]
out = subprocess.check_output(self.mintro_command + args + [directory],
- universal_newlines=True)
+ encoding='utf-8', universal_newlines=True)
try:
obj = json.loads(out)
except Exception as e:
diff --git a/unittests/helpers.py b/unittests/helpers.py
index 5e9192955..2f97ab1d4 100644
--- a/unittests/helpers.py
+++ b/unittests/helpers.py
@@ -167,7 +167,7 @@ def get_dynamic_section_entry(fname: str, entry: str) -> T.Optional[str]:
try:
raw_out = subprocess.check_output(['readelf', '-d', fname],
- universal_newlines=True)
+ encoding='utf-8', universal_newlines=True)
except FileNotFoundError:
# FIXME: Try using depfixer.py:Elf() as a fallback
raise unittest.SkipTest('readelf not found')
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py
index 16997e393..cfad8fece 100644
--- a/unittests/linuxliketests.py
+++ b/unittests/linuxliketests.py
@@ -1703,7 +1703,7 @@ class LinuxlikeTests(BasePlatformTests):
p = subprocess.run([ar, 't', outlib],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
- text=True, timeout=1)
+ encoding='utf-8', text=True, timeout=1)
obj_files = p.stdout.strip().split('\n')
self.assertEqual(len(obj_files), 1)
self.assertTrue(obj_files[0].endswith('-prelink.o'))
diff --git a/unittests/machinefiletests.py b/unittests/machinefiletests.py
index 5ff862cdc..8de0c602d 100644
--- a/unittests/machinefiletests.py
+++ b/unittests/machinefiletests.py
@@ -50,7 +50,7 @@ def is_real_gnu_compiler(path):
'''
if not path:
return False
- out = subprocess.check_output([path, '--version'], universal_newlines=True, stderr=subprocess.STDOUT)
+ out = subprocess.check_output([path, '--version'], encoding='utf-8', universal_newlines=True, stderr=subprocess.STDOUT)
return 'Free Software Foundation' in out
cross_dir = Path(__file__).parent.parent / 'cross'
diff --git a/unittests/rewritetests.py b/unittests/rewritetests.py
index af5e204dc..a9e72b369 100644
--- a/unittests/rewritetests.py
+++ b/unittests/rewritetests.py
@@ -28,7 +28,7 @@ class RewriterTests(BasePlatformTests):
if isinstance(args, str):
args = [args]
command = self.rewrite_command + ['--verbose', '--skip', '--sourcedir', directory] + args
- p = subprocess.run(command, capture_output=True, text=True, timeout=60)
+ p = subprocess.run(command, capture_output=True, encoding='utf-8', text=True, timeout=60)
print('STDOUT:')
print(p.stdout)
print('STDERR:')