diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51dea0f..3653bde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,6 @@ jobs: uses: py-actions/flake8@v2 with: ignore: "BLK100" - exclude: "tests/*" max-line-length: "128" path: "." plugins: "flake8-bugbear==22.1.11 flake8-black" diff --git a/tests/detect-usb.py b/tests/detect-usb.py index fa05753..234e29d 100755 --- a/tests/detect-usb.py +++ b/tests/detect-usb.py @@ -1,5 +1,4 @@ #!/usr/bin/python3 - import pyudev import psutil import time @@ -51,9 +50,9 @@ for device in iter(monitor.poll, None): for partition in psutil.disk_partitions(): if partition.device == device.device_node: print("Mounted at {}".format(partition.mountpoint)) - statvfs=os.statvfs(partition.mountpoint) - print("size %4.1fGB"% (statvfs.f_frsize * statvfs.f_blocks // 1024 // 1024 / 1024)) - print("used %4.1fGB"% (statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree) // 1024 // 1024 / 1024)) + statvfs = os.statvfs(partition.mountpoint) + print("size %4.1fGB" % (statvfs.f_frsize * statvfs.f_blocks // 1024 // 1024 / 1024)) + print("used %4.1fGB" % (statvfs.f_frsize * (statvfs.f_blocks - statvfs.f_bfree) // 1024 // 1024 / 1024)) found = True loop += 1 else: diff --git a/tests/images.py b/tests/images.py index 1b0ff60..a5683db 100755 --- a/tests/images.py +++ b/tests/images.py @@ -1,5 +1,4 @@ #!/usr/bin/python3 - import os import time @@ -11,4 +10,3 @@ os.system("convert -resize 1024x600 -background black -gravity center -extent 10 time.sleep(1) os.system("convert -resize 1024x600 -background black -gravity center -extent 1024x600 image2.png bgra:/dev/fb0") time.sleep(1) - diff --git a/tests/loop.py b/tests/loop.py index bd84186..91e1626 100755 --- a/tests/loop.py +++ b/tests/loop.py @@ -1,17 +1,19 @@ #!/usr/bin/python3 -import os; +import os + def waitMouseClick(): - mouse = open( "/dev/input/mice", "rb" ) - down = False; + mouse = open("/dev/input/mice", "rb") + down = False while True: buf = mouse.read(3) - if ((buf[0] & 0x1)==1): + if ((buf[0] & 0x1) == 1): down = True - if (((buf[0] & 0x1)==0) and down): - break; + if (((buf[0] & 0x1) == 0) and down): + break mouse.close() + while True: os.system("killall fim") os.system("fim -qa image1.png 2>/dev/null &") @@ -19,4 +21,3 @@ while True: os.system("killall fim") os.system("fim -qa image2.png 2>/dev/null &") waitMouseClick() - diff --git a/tests/mouse-click.py b/tests/mouse-click.py index 216d421..153187e 100755 --- a/tests/mouse-click.py +++ b/tests/mouse-click.py @@ -1,15 +1,15 @@ #!/usr/bin/python3 def waitMouseClick(): - mouse = open( "/dev/input/mice", "rb" ) - down = False; + mouse = open("/dev/input/mice", "rb") + down = False while True: buf = mouse.read(3) - if ((buf[0] & 0x1)==1): + if ((buf[0] & 0x1) == 1): down = True - if (((buf[0] & 0x1)==0) and down): - break; + if (((buf[0] & 0x1) == 0) and down): + break mouse.close() -waitMouseClick() +waitMouseClick() diff --git a/tests/progress-bar.py b/tests/progress-bar.py index a34561f..37159f9 100755 --- a/tests/progress-bar.py +++ b/tests/progress-bar.py @@ -14,8 +14,8 @@ def initBar(): def updateBar(progress): global progress_win - pos = (60 * progress) // 100 - if pos != 0 : + pos = (60 * progress) // 100 + if pos != 0: progress_win.addstr(1, 1, "#" * pos) progress_win.refresh() @@ -26,8 +26,5 @@ while loading <= 100: time.sleep(0.03) updateBar(loading) loading += 3 - time.sleep(1) - -#curses.endwin() curses.flushinp() diff --git a/tests/slideshow.py b/tests/slideshow.py index 1f507a7..da468de 100755 --- a/tests/slideshow.py +++ b/tests/slideshow.py @@ -1,17 +1,19 @@ #!/usr/bin/python3 -import os; +import os + def waitMouseClick(): - mouse = open( "/dev/input/mice", "rb" ) - down = False; + mouse = open("/dev/input/mice", "rb") + down = False while True: buf = mouse.read(3) - if ((buf[0] & 0x1)==1): + if ((buf[0] & 0x1) == 1): down = True - if (((buf[0] & 0x1)==0) and down): - break; + if (((buf[0] & 0x1) == 0) and down): + break mouse.close() + os.system("fim *.png -qa -c 'while(1){display;sleep 1;next;}' /dev/null &") waitMouseClick() os.system("killall -s 9 fim") diff --git a/tests/states.py b/tests/states.py index bee200c..0bdee90 100755 --- a/tests/states.py +++ b/tests/states.py @@ -1,20 +1,20 @@ #!/usr/bin/python3 -# def waitMouseClick(): print("wait mouse click") - mouse = open( "/dev/input/mice", "rb" ) - down = False; + mouse = open("/dev/input/mice", "rb") + down = False while True: buf = mouse.read(3) - if ((buf[0] & 0x1)==1): + if ((buf[0] & 0x1) == 1): down = True - if (((buf[0] & 0x1)==0) and down): - break; + if (((buf[0] & 0x1) == 0) and down): + break mouse.close() + def loop(state): - print('loop ' +state) + print('loop ' + state) match state: case "START": waitMouseClick() @@ -26,16 +26,13 @@ def loop(state): waitMouseClick() return "STOP" case _: - print("Unknwn state "+state) + print("Unknwn state " + state) return "STOP" print("end loop") if __name__ == "__main__": # The client code. - - state="START" - while (state!="STOP"): + state = "START" + while (state != "STOP"): state = loop(state) - -