Skip to content

Commit

Permalink
Fix harmless warning: Close sub-archives without members as well
Browse files Browse the repository at this point in the history
Fix the warning about closing the sub-archive if it got no members.

Signed-off-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
bernhardkaindl committed Jan 12, 2024
1 parent 921f8d1 commit 0693a85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/unit/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def minimal_bugtool(bugtool, dom0_template, archive, subdir):
bugtool.PLUGIN_DIR = dom0_template + "/etc/xensource/bugtool"
bugtool.entries = ["mock"]
archive.declare_subarchive("/etc/passwd", subdir + "/etc/passwd.tar")
# For code coverage: This sub-archive will not be created as it has no file
archive.declare_subarchive("/not/existing", subdir + "/not_created.tar")
bugtool.load_plugins(just_capabilities=False)
# Mock the 2nd argument of the ls -l /etc to collect it using dom0_template:
bugtool.data["ls -l /etc"]["cmd_args"][2] = dom0_template + "/etc"
Expand Down
2 changes: 2 additions & 0 deletions xen-bugtool
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,8 @@ class ArchiveWithTarSubarchives(object):
if subarchive.file.getmembers():
subarchive.file.close()
self.add_path_with_data(subarchive.name, subarchive)
else:
subarchive.file.close()

def add_path_with_data(self, _name, _data):
"""Implemented by the subclasses TarOutput/ZipOutput to add paths with data"""
Expand Down

1 comment on commit 0693a85

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

https://github.com/marketplace/actions/pytest-coverage-comment
FileStmtsMissCoverMissing
__init__.py00100% 
conftest.py300100% 
test_dir_list.py110100% 
test_fs_funcs.py100100% 
test_load_plugins.py50100% 
test_output.py480100% 
test_process_output.py80100% 
test_xapidb_filter.py170100% 
xen-bugtool152468654%95, 100–101, 410, 490–491, 493–494, 511, 517, 540, 551–552, 555–556, 602, 607–608, 612, 614–618, 620, 632–634, 637, 656–657, 660, 662–666, 668–669, 672–673, 677–678, 680–681, 685–688, 690–693, 696–698, 700–701, 705–707, 710–711, 720, 722, 724–727, 729–731, 733–734, 738–739, 741, 743–749, 753–754, 756–760, 765–773, 775–777, 779–781, 783–784, 786, 801, 803–807, 809–810, 812, 814, 816–839, 842–846, 848, 850–871, 874–875, 877, 879, 882, 884–893, 895, 897–900, 902–912, 914–930, 932–936, 938–944, 947–976, 978–988, 990–993, 995–1015, 1017–1020, 1022, 1024, 1026–1027, 1029–1030, 1032, 1047–1048, 1050–1051, 1055–1056, 1058–1059, 1061, 1063, 1065–1066, 1068–1069, 1071–1080, 1083–1089, 1092–1093, 1095–1096, 1105–1106, 1108–1109, 1113, 1135–1138, 1140–1144, 1146–1153, 1155, 1157–1160, 1162, 1165–1167, 1169–1175, 1178–1180, 1184–1185, 1187–1188, 1190–1192, 1195–1196, 1199, 1201–1202, 1204, 1206, 1208–1209, 1213–1216, 1219, 1222, 1225–1227, 1230–1234, 1237–1238, 1241–1244, 1250–1256, 1259–1263, 1265–1281, 1284–1292, 1295–1296, 1298, 1300–1301, 1303–1311, 1314, 1316–1319, 1321, 1323–1324, 1358, 1386, 1401, 1409–1410, 1414–1416, 1418, 1421, 1423–1425, 1427–1431, 1433, 1437, 1440, 1443–1449, 1451, 1453–1457, 1463–1465, 1467–1472, 1475–1479, 1483–1484, 1486, 1503–1504, 1506, 1508–1509, 1511–1513, 1515–1522, 1524–1529, 1533–1534, 1536, 1538, 1540, 1556–1557, 1559, 1561–1563, 1566–1567, 1569, 1571–1573, 1576–1577, 1579, 1581–1584, 1587–1597, 1600–1604, 1614, 1626, 1636, 1640, 1651, 1675–1677, 1746, 1752, 1787, 1811, 1826, 1886, 1905, 1907, 1909, 1912–1920, 1923–1924, 1927–1934, 1936–1937, 1939, 1943–1944, 1948, 1952–1954, 1958–1959, 1962, 1966, 1971, 1977–1978, 1980, 1984, 1986–1989, 1992–2002, 2006, 2008, 2093–2095, 2098–2100, 2112, 2131–2133, 2173–2177, 2184, 2186–2189, 2193, 2207
TOTAL165368658% 

Tests Skipped Failures Errors Time
11 0 💤 0 ❌ 0 🔥 0.815s ⏱️

Please sign in to comment.