snapshot of https://github.com/ActivityWatch/activitywatch.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Research feed publisher tests / test (push) Failing after 3s
Release / Pre-flight checks (push) Failing after 0s
Release / Research Edition — patch and packaging smoke tests (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, false, false, false) (push) Has been skipped
Release / Build Qt artifacts (manylinux_2_28 — glibc 2.28 ABI floor) (22, 3.9) (push) Has been skipped
Release / Generate release notes (push) Has been skipped
Release / Create dev release tag (push) Has been skipped
CodeQL / Analyze (javascript) (push) Failing after 1s
CodeQL / Analyze (python) (push) Failing after 1s
Release / Build Qt artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04-arm, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Publish draft release (push) Has been cancelled
Some checks failed
Research feed publisher tests / test (push) Failing after 3s
Release / Pre-flight checks (push) Failing after 0s
Release / Research Edition — patch and packaging smoke tests (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been skipped
Release / Build Qt artifacts (false, 22, ubuntu-22.04, 3.9, false, false, false) (push) Has been skipped
Release / Build Qt artifacts (manylinux_2_28 — glibc 2.28 ABI floor) (22, 3.9) (push) Has been skipped
Release / Generate release notes (push) Has been skipped
Release / Create dev release tag (push) Has been skipped
CodeQL / Analyze (javascript) (push) Failing after 1s
CodeQL / Analyze (python) (push) Failing after 1s
Release / Build Qt artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, ubuntu-24.04-arm, 3.9, false, false, false) (push) Has been cancelled
Release / Build Tauri artifacts (false, 22, windows-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-15-intel, 3.9, false, false, false) (push) Has been cancelled
Release / Build Qt artifacts (false, 22, macos-latest, 3.9, false, false, false) (push) Has been cancelled
Release / Publish draft release (push) Has been cancelled
This commit is contained in:
84
scripts/tests/integration_tests.py
Normal file
84
scripts/tests/integration_tests.py
Normal file
@@ -0,0 +1,84 @@
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import tempfile
|
||||
from time import sleep
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def _windows_kill_process(pid):
|
||||
import ctypes
|
||||
|
||||
PROCESS_TERMINATE = 1
|
||||
handle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, False, pid)
|
||||
ctypes.windll.kernel32.TerminateProcess(handle, -1)
|
||||
ctypes.windll.kernel32.CloseHandle(handle)
|
||||
|
||||
|
||||
# NOTE: to run tests with a specific server binary,
|
||||
# set the PATH such that it is the "aw-server" binary.
|
||||
@pytest.fixture(scope="session")
|
||||
def server_process():
|
||||
logfile_stdout = tempfile.NamedTemporaryFile(delete=False)
|
||||
logfile_stderr = tempfile.NamedTemporaryFile(delete=False)
|
||||
|
||||
# find the path of the "aw-server" binary and log it
|
||||
which_server = subprocess.check_output(["which", "aw-server"], text=True)
|
||||
print(f"aw-server path: {which_server}")
|
||||
|
||||
# if aw-server-rust in PATH, assert that we're picking up the aw-server-rust binary
|
||||
if "aw-server-rust" in os.environ["PATH"]:
|
||||
assert "aw-server-rust" in which_server
|
||||
|
||||
server_proc = subprocess.Popen(
|
||||
["aw-server", "--testing"], stdout=logfile_stdout, stderr=logfile_stderr
|
||||
)
|
||||
|
||||
# Wait for server to start up properly
|
||||
# TODO: Ping the server until it's alive to remove this sleep
|
||||
sleep(5)
|
||||
|
||||
yield server_proc
|
||||
|
||||
if platform.system() == "Windows":
|
||||
# On Windows, for whatever reason, server_proc.kill() doesn't do the job.
|
||||
_windows_kill_process(server_proc.pid)
|
||||
else:
|
||||
server_proc.kill()
|
||||
server_proc.wait(5)
|
||||
server_proc.communicate()
|
||||
|
||||
error_indicators = ["ERROR"]
|
||||
|
||||
with open(logfile_stdout.name, "r+b") as f:
|
||||
stdout = str(f.read(), "utf8")
|
||||
if any(e in stdout for e in error_indicators):
|
||||
pytest.fail(f"Found ERROR indicator in stdout from server: {stdout}")
|
||||
|
||||
with open(logfile_stderr.name, "r+b") as f:
|
||||
stderr = str(f.read(), "utf8")
|
||||
# For some reason, this fails aw-server-rust, but not aw-server-python
|
||||
# if not stderr:
|
||||
# pytest.fail("No output to stderr from server")
|
||||
|
||||
# Will show in case pytest fails
|
||||
print(stderr)
|
||||
|
||||
for s in error_indicators:
|
||||
if s in stderr:
|
||||
pytest.fail(f"Found ERROR indicator in stderr from server: {s}")
|
||||
|
||||
# NOTE: returncode was -9 for whatever reason
|
||||
# if server_proc.returncode != 0:
|
||||
# pytest.fail("Exit code was non-zero ({})".format(server_proc.returncode))
|
||||
|
||||
|
||||
# TODO: Use the fixture in the tests instead of this thing here
|
||||
def test_integration(server_process):
|
||||
# This is just here so that the server_process fixture is initialized
|
||||
pass
|
||||
|
||||
# exit_code = pytest.main(["./aw-server/tests", "-v"])
|
||||
# if exit_code != 0:
|
||||
# pytest.fail("Tests exited with non-zero code: " + str(exit_code))
|
||||
Reference in New Issue
Block a user