Skip to content

Commit

Permalink
tests: use a shell wrapper instead of pytest to run the tests
Browse files Browse the repository at this point in the history
This is mostly to improve the debugging experience. It is often very
useful to run tests with gdb, and the pytest method makes it
impossible to do correctly without many changes. By having a wrapper,
it is as simple as calling the wrapper with the extra meson arguments
  • Loading branch information
pabloyoyoista committed Sep 18, 2024
1 parent 98c2389 commit 085c8b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
run: meson build && ninja -C build

- name: Test
run: dbus-run-session -- meson test -v -C build
run: dbus-run-session ./tests/test_wrapper.sh -- meson test -v -C build
4 changes: 1 addition & 3 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ test_env = [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'MALLOC_CHECK_=2',
'DBUS_TEST_LOG=@0@/@1@'.format(meson.current_build_dir(), 'dbus-test.log'),
]

test_program = find_program('test.py', dirs : [meson.current_source_dir()])
test('gs-self-test-apk', test_program, env : test_env)
test('gs-self-test-apk', test, env : test_env)
43 changes: 0 additions & 43 deletions tests/test.py

This file was deleted.

14 changes: 14 additions & 0 deletions tests/test_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Copyright (C) 2024 Pablo Correa Gomez
#

set -ex

python3 -m dbusmock --session --template "$(dirname "$0")"/apkpolkit2.py &

sleep 1

trap 'kill %1' EXIT

"$@"

0 comments on commit 085c8b0

Please sign in to comment.