aboutsummaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2023-07-12 14:10:08 -0500
committerDylan Baker <dylan@pnwbakers.com>2023-07-13 09:55:10 -0700
commit3784f729731c6fd1aacc6e9fe26f9a7e363c56b1 (patch)
tree8e420867193064c0b6e87eee70bd90f7d8c9068d /unittests/allplatformstests.py
parentbd3d2cf91894b1f91128011b2cf56a5bd2c326ae (diff)
downloadmeson-3784f729731c6fd1aacc6e9fe26f9a7e363c56b1.zip
meson-3784f729731c6fd1aacc6e9fe26f9a7e363c56b1.tar.gz
meson-3784f729731c6fd1aacc6e9fe26f9a7e363c56b1.tar.bz2
Silence some encoding warnings
By specifiying explicit encodings, we can silence warnings like: /__w/meson/meson/test cases/common/100 postconf with args/postconf.py:15: EncodingWarning: 'encoding' argument not specified with open(input_file) as f: in CI.
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index db8a2f0..b4bf371 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -2718,7 +2718,7 @@ class AllPlatformTests(BasePlatformTests):
def test_native_dep_pkgconfig(self):
testdir = os.path.join(self.unit_test_dir,
'45 native dep pkgconfig var')
- with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
+ with tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8') as crossfile:
crossfile.write(textwrap.dedent(
'''[binaries]
pkgconfig = '{}'
@@ -2745,7 +2745,7 @@ class AllPlatformTests(BasePlatformTests):
def test_pkg_config_libdir(self):
testdir = os.path.join(self.unit_test_dir,
'45 native dep pkgconfig var')
- with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
+ with tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8') as crossfile:
crossfile.write(textwrap.dedent(
'''[binaries]
pkgconfig = 'pkg-config'
@@ -4196,7 +4196,7 @@ class AllPlatformTests(BasePlatformTests):
cmd = self.meson_command + ['devenv', '-C', self.builddir, '--dump', fname]
o = self._run(cmd)
self.assertEqual(o, '')
- o = Path(fname).read_text()
+ o = Path(fname).read_text(encoding='utf-8')
expected = os.pathsep.join(['/prefix', '$TEST_C', '/suffix'])
self.assertIn(f'TEST_C="{expected}"', o)
self.assertIn('export TEST_C', o)
@@ -4697,7 +4697,7 @@ class AllPlatformTests(BasePlatformTests):
testdir = os.path.join(self.unit_test_dir, '102 rlib linkage')
gen_file = os.path.join(testdir, 'lib.rs')
- with open(gen_file, 'w') as f:
+ with open(gen_file, 'w', encoding='utf-8') as f:
f.write(template.format(0))
self.addCleanup(windows_proof_rm, gen_file)
@@ -4705,7 +4705,7 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
- with open(gen_file, 'w') as f:
+ with open(gen_file, 'w', encoding='utf-8') as f:
f.write(template.format(39))
self.build()