[tracker/sam/tracker-2.3-developer-experience: 43/45] utils/trackertestutils: Make it usable by other projects



commit 833bdd81575105b1ca3ab48b0d9db77ef72f1fcd
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 28 14:44:07 2019 +0200

    utils/trackertestutils: Make it usable by other projects
    
    This commit makes the tracker-testutils-2.0 package more reusable.
    The idea is that projects using Tracker can use this as a way to
    sandbox their test suites from the user's real Tracker data.
    
    In your meson.build file you would do something like this to locate
    the script and run your test.
    
        python3 = find_program('python3')
        trackertestutils = dependency('tracker-testutils-2.0')
    
        tracker_sandbox_command = find_program(trackertestutils.get_pkgconfig_variable('command'))
    
        test('myapptest', tracker_sandbox_command,
          args: ['--index-tmpdir', my_app_test_executable])
    
    This would ensure that XDG_CACHE_HOME and XDG_DATA_HOME point to a
    temporary directory, separate from any real Tracker index data that the
    current user might have inside their XDG cache & data directories.

 utils/trackertestutils/meson.build        | 1 +
 utils/trackertestutils/tracker-sandbox.in | 5 +++++
 2 files changed, 6 insertions(+)
---
diff --git a/utils/trackertestutils/meson.build b/utils/trackertestutils/meson.build
index e8ab94c72..e7271fc86 100644
--- a/utils/trackertestutils/meson.build
+++ b/utils/trackertestutils/meson.build
@@ -1,5 +1,6 @@
 sources = [
   '__init__.py',
+  '__main__.py',
   'dbusdaemon.py',
   'dconf.py',
   'helpers.py',
diff --git a/utils/trackertestutils/tracker-sandbox.in b/utils/trackertestutils/tracker-sandbox.in
new file mode 100755
index 000000000..4c47755a0
--- /dev/null
+++ b/utils/trackertestutils/tracker-sandbox.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+export PYTHONPATH=@testutils_dir@
+
+python3 -m trackertestutils --prefix=@prefix@ $@


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]