From b01b40b51b8b55a72c50a477d187fdd3e557550b Mon Sep 17 00:00:00 2001 From: Joe Farebrother Date: Tue, 9 Sep 2025 13:44:03 +0100 Subject: [PATCH] Update test output --- .../FileNotAlwaysClosed/FileNotAlwaysClosed.expected | 4 +++- .../Resources/FileNotAlwaysClosed/resources_test.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/FileNotAlwaysClosed.expected b/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/FileNotAlwaysClosed.expected index ffa392b03f1..579424e9318 100644 --- a/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/FileNotAlwaysClosed.expected +++ b/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/FileNotAlwaysClosed.expected @@ -1,10 +1,12 @@ +#select | resources_test.py:4:10:4:25 | ControlFlowNode for open() | File may not be closed if $@ raises an exception. | resources_test.py:5:5:5:33 | ControlFlowNode for Attribute() | this operation | | resources_test.py:9:10:9:25 | ControlFlowNode for open() | File is opened but is not closed. | file://:0:0:0:0 | (none) | this operation | | resources_test.py:108:11:108:20 | ControlFlowNode for open() | File is opened but is not closed. | file://:0:0:0:0 | (none) | this operation | | resources_test.py:112:11:112:28 | ControlFlowNode for opener_func2() | File may not be closed if $@ raises an exception. | resources_test.py:113:5:113:22 | ControlFlowNode for Attribute() | this operation | | resources_test.py:123:11:123:24 | ControlFlowNode for opener_func2() | File is opened but is not closed. | file://:0:0:0:0 | (none) | this operation | | resources_test.py:129:15:129:24 | ControlFlowNode for open() | File may not be closed if $@ raises an exception. | resources_test.py:130:9:130:26 | ControlFlowNode for Attribute() | this operation | -| resources_test.py:154:15:154:24 | ControlFlowNode for open() | File may not be closed if $@ raises an exception. | resources_test.py:159:9:159:18 | ControlFlowNode for Attribute() | this operation | | resources_test.py:248:11:248:25 | ControlFlowNode for open() | File is opened but is not closed. | file://:0:0:0:0 | (none) | this operation | | resources_test.py:269:10:269:27 | ControlFlowNode for Attribute() | File may not be closed if $@ raises an exception. | resources_test.py:271:5:271:19 | ControlFlowNode for Attribute() | this operation | | resources_test.py:285:11:285:20 | ControlFlowNode for open() | File may not be closed if $@ raises an exception. | resources_test.py:287:5:287:31 | ControlFlowNode for Attribute() | this operation | +testFailures +| resources_test.py:154:26:154:154 | Comment # $SPURIOUS: Alert # Dataflow appears to not detect this with statement as guarding the exceptions produced by the `read()` call. | Fixed spurious result: Alert | diff --git a/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/resources_test.py b/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/resources_test.py index 0f9edc02803..972cc3a7be2 100644 --- a/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/resources_test.py +++ b/python/ql/test/query-tests/Resources/FileNotAlwaysClosed/resources_test.py @@ -293,7 +293,7 @@ class NotWrapper: self.data = fp.read() fp.close() - def do_something(): + def do_something(self): pass def closed30(path): @@ -322,7 +322,7 @@ class Wrapper(): return self.f.read() def __enter__(self): pass - def __exit__(self): + def __exit__(self,exc_type, exc_value,traceback): self.f.close() def closed32(path):