From 8c777781f97c3c4da540d89847dd2a3eb327c78c Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:29:35 +0200 Subject: [PATCH] simplify tests --- tests/{utils.py => common.py} | 0 tests/keyboard_test.py | 8 +++----- tests/mouse_test.py | 8 +++----- 3 files changed, 6 insertions(+), 10 deletions(-) rename tests/{utils.py => common.py} (100%) diff --git a/tests/utils.py b/tests/common.py similarity index 100% rename from tests/utils.py rename to tests/common.py diff --git a/tests/keyboard_test.py b/tests/keyboard_test.py index 95dd8b5..00900e9 100644 --- a/tests/keyboard_test.py +++ b/tests/keyboard_test.py @@ -1,10 +1,9 @@ import tempfile from zero_hid import Keyboard -from utils import random_file +from common import random_file def test_typing(): - path = random_file() - with open(path, 'ab+') as f: + with open(random_file(), 'ab+') as f: k = Keyboard(f) k.type("Hello world!") f.seek(0) @@ -16,8 +15,7 @@ def test_typing(): def test_release(): - path = random_file() - with open(path, 'ab+') as f: + with open(random_file(), 'ab+') as f: k = Keyboard(f) k.release() f.seek(0) diff --git a/tests/mouse_test.py b/tests/mouse_test.py index 91392a0..abde3b4 100644 --- a/tests/mouse_test.py +++ b/tests/mouse_test.py @@ -1,10 +1,9 @@ import tempfile from zero_hid import Mouse -from utils import random_file +from common import random_file def test_left_click(): - path = random_file() - with open(path, 'ab+') as f: + with open(random_file(), 'ab+') as f: m = Mouse(f) m.left_click() f.seek(0) @@ -14,8 +13,7 @@ def test_left_click(): def test_move(): - path = random_file() - with open(path, 'ab+') as f: + with open(random_file(), 'ab+') as f: m = Mouse(f) m.move_relative(100, 100) f.seek(0)