Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_win_close():
p = None
try:
p = subprocess.Popen('notepad')
time.sleep(1) # give notepad time to start up
win = ahk.win_get(title='Untitled - Notepad')
assert win
assert win.position
win.close()
with pytest.raises(WindowNotFoundError):
ahk.win_get(title='Untitled - Notepad').position
finally:
if p is not None:
p.terminate()
def _get_pos(self):
script = self._render_template('window/win_position.ahk')
resp = self.engine.run_script(script)
try:
value = ast.literal_eval(resp)
return value
except SyntaxError:
raise WindowNotFoundError('No window found')