1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-22 14:38:53 +02:00

Fix resource warnings (unclosed files)

This commit is contained in:
2022-08-24 08:43:09 +02:00
parent 1c581fdf2c
commit 9cc4a5594f
11 changed files with 81 additions and 44 deletions

View File

@@ -40,7 +40,7 @@ class TestCommit(OscTestCase):
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_digests('testSimple_cfilesremote')
self.assertTrue(os.path.exists('nochange'))
self.assertEqual(open('nochange').read(), open(os.path.join('.osc', 'nochange')).read())
self.assertFilesEqual('nochange', os.path.join('.osc', 'nochange'))
self._check_status(p, 'nochange', ' ')
self._check_status(p, 'foo', ' ')
self._check_status(p, 'merge', ' ')
@@ -64,7 +64,7 @@ class TestCommit(OscTestCase):
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_digests('testAddfile_cfilesremote')
self.assertTrue(os.path.exists('add'))
self.assertEqual(open('add').read(), open(os.path.join('.osc', 'add')).read())
self.assertFilesEqual('add', os.path.join('.osc', 'add'))
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_added')))
self._check_status(p, 'add', ' ')
self._check_status(p, 'foo', ' ')
@@ -241,7 +241,7 @@ class TestCommit(OscTestCase):
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_digests('testAddfile_cfilesremote')
self.assertTrue(os.path.exists('add'))
self.assertEqual(open('add').read(), open(os.path.join('.osc', 'add')).read())
self.assertFilesEqual('add', os.path.join('.osc', 'add'))
self.assertFalse(os.path.exists(os.path.join('.osc', '_to_be_added')))
self._check_status(p, 'add', ' ')
self._check_status(p, 'foo', ' ')
@@ -341,7 +341,7 @@ class TestCommit(OscTestCase):
self.assertEqual(sys.stdout.getvalue(), exp)
self._check_digests('testSimple_cfilesremote')
self.assertTrue(os.path.exists('nochange'))
self.assertEqual(open('nochange').read(), open(os.path.join('.osc', 'nochange')).read())
self.assertFilesEqual('nochange', os.path.join('.osc', 'nochange'))
self._check_status(p, 'nochange', ' ')
self._check_status(p, 'foo', ' ')
self._check_status(p, 'merge', ' ')