Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 12, 2023
1 parent 1da2609 commit 468cfd5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/_sync/test_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import asyncio
import os
import pathlib
import subprocess
import sys
import time
from unittest import TestCase
from unittest import mock

from ahk import AHK
from ahk import Window


sleep = time.sleep


class TestScripts(TestCase):
win: Window

def setUp(self) -> None:
self.ahk = AHK()

def tearDown(self) -> None:
try:
self.ahk._transport._proc.kill()
except:
pass
time.sleep(0.2)

def test_script_missing_makes_tempfile(self):
with mock.patch('os.path.exists', new=mock.Mock(return_value=False)):
pos = self.ahk.get_mouse_position()
path = pathlib.Path(self.ahk._transport._proc.runargs[-1])
filename = path.name
assert filename.startswith('python-ahk-')
assert filename.endswith('.ahk')
assert isinstance(pos, tuple) and isinstance(pos[0], int)

0 comments on commit 468cfd5

Please sign in to comment.