unittests: fix EncodingWarnings. minus 123 warnings collected by pytest

pull/13483/head
Eli Schwartz 4 months ago
parent 28ab1ce39a
commit 077d540c10
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 4
      unittests/baseplatformtests.py
  2. 2
      unittests/helpers.py
  3. 2
      unittests/linuxliketests.py
  4. 2
      unittests/machinefiletests.py
  5. 2
      unittests/rewritetests.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:

@ -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')

@ -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'))

@ -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'

@ -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:')

Loading…
Cancel
Save