Skip to content

Commit

Permalink
test: add a pytest wrapper for libwacom
Browse files Browse the repository at this point in the history
This wraps libwacom into python ctypes interface, including a wrapper
class that makes interacting with it a bit more pythonic. Most of this
code is taken from libei's oeffis pytests.
  • Loading branch information
whot committed May 7, 2024
1 parent 25bf5f8 commit 0feb7c2
Show file tree
Hide file tree
Showing 2 changed files with 940 additions and 2 deletions.
8 changes: 6 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project('libwacom', 'c',
version: '2.11.0',
license: 'HPND',
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version: '>= 0.51.0')
meson_version: '>= 0.53.0')

dir_bin = get_option('prefix') / get_option('bindir')
dir_data = get_option('prefix') / get_option('datadir') / 'libwacom'
Expand All @@ -17,6 +17,7 @@ if dir_udev == ''
dir_udev = dir_sys_udev
endif

fs = import('fs')
pymod = import('python')
python = pymod.find_installation('python3', required: true)

Expand Down Expand Up @@ -295,12 +296,15 @@ if get_option('tests').enabled()
message('valgrind not found, disabling valgrind test suite')
endif

env = environment()
env.set('MESON_SOURCE_ROOT', meson.current_source_dir())
env.set('LD_LIBRARY_PATH', fs.parent(lib_libwacom.full_path()))
pymod.find_installation(modules: ['libevdev', 'pyudev', 'pytest'])
pytest = find_program('pytest-3', 'pytest')
test('pytest',
pytest,
args: [meson.current_source_dir()],
env: ['MESON_SOURCE_ROOT=@0@'.format(meson.current_source_dir())],
env: env,
suite: ['all'])
endif

Expand Down
Loading

0 comments on commit 0feb7c2

Please sign in to comment.