run_unittests: fix unused variable warnings

We don't actually want to do anything with the open()ed file, just
immediately close it.

The CalledProcessError doesn't have its return returncode checked
here, even though other code with the same type of context manager does.
This commit is contained in:
Eli Schwartz 2021-06-06 20:03:39 -04:00
parent 3340d373fb
commit ead4ba7777
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
1 changed files with 2 additions and 2 deletions

View File

@ -538,7 +538,7 @@ class AllPlatformTests(BasePlatformTests):
def test_implicit_forcefallback(self): def test_implicit_forcefallback(self):
testdir = os.path.join(self.unit_test_dir, '96 implicit force fallback') testdir = os.path.join(self.unit_test_dir, '96 implicit force fallback')
with self.assertRaises(subprocess.CalledProcessError) as cm: with self.assertRaises(subprocess.CalledProcessError):
self.init(testdir) self.init(testdir)
self.init(testdir, extra_args=['--wrap-mode=forcefallback']) self.init(testdir, extra_args=['--wrap-mode=forcefallback'])
self.new_builddir() self.new_builddir()
@ -3605,7 +3605,7 @@ class AllPlatformTests(BasePlatformTests):
cmakefile = Path(testdir) / 'subprojects' / 'sub2' / 'CMakeLists.txt' cmakefile = Path(testdir) / 'subprojects' / 'sub2' / 'CMakeLists.txt'
self.init(testdir) self.init(testdir)
self.build() self.build()
with cmakefile.open('a', encoding='utf-8') as f: with cmakefile.open('a', encoding='utf-8'):
os.utime(str(cmakefile)) os.utime(str(cmakefile))
self.assertReconfiguredBuildIsNoop() self.assertReconfiguredBuildIsNoop()