GabMus's Dev Log

Python unittest + Meson


Alright, I started writing some unit tests for Feeds and I wanted to integrate them into meson, so that I can just run meson test or ninja test during build and have them run automagically.

As an added bonus, they should also run when creating a flatpak package, so that I don’t accidentally push a broken built to users.

Here’s the very simplistic way I accomplished this task:

  • have your tests in a tests directory in the root of your project
  • add this to your
envdata = environment()
python_paths = [join_paths(meson.current_build_dir(), '..')]
envdata.append('PYTHONPATH', python_paths)
envdata.append('TESTS_BUILDDIR', meson.current_build_dir())
  args: ['-m', 'unittest', 'tests'],
  env: envdata

While this works locally, I’m still having problems with running them during the flatpak build in GitLab CI, so I’ll try to solve that as well and update this post accordingly.

Enter your instance's address

More posts like this

Giara is a reddit app for Linux

2020-10-30 | #giara #gnome #gtk #linux #reddit #world

I am a quite avid reddit user. Like it or not, reddit is a very central place where communities for stuff that I care about tend to aggregate. For the longest time, I have felt the need for a reddit app on my Linux desktop, and I waited and kept waiting for one that would finally allow me to break free of using the web version.

Continue reading 