[tracker: 1/2] Fix Python test fixtures to run on macOS
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 1/2] Fix Python test fixtures to run on macOS
- Date: Mon, 19 Apr 2021 08:49:23 +0000 (UTC)
commit fad4f4d0422df418bb951daa6e94648674767be1
Author: Daniele Nicolodi <daniele grinta net>
Date: Sun Apr 18 09:39:15 2021 +0200
Fix Python test fixtures to run on macOS
On macOS the default start method for multiprocessing processes is
spawn which makes dynamic modification of the code passed to the
worker processes (the addition of the tmpdir member in this case)
problematic. The issue is esily solved passing the tmpdir to the
worker function as a parameter.
tests/functional-tests/fixtures.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/tests/functional-tests/fixtures.py b/tests/functional-tests/fixtures.py
index 1f3fa6baf..9a05ffe10 100644
--- a/tests/functional-tests/fixtures.py
+++ b/tests/functional-tests/fixtures.py
@@ -112,8 +112,8 @@ class TrackerSparqlBusTest (ut.TestCase):
fixture setup.
"""
- @classmethod
- def database_process_fn(self, message_queue):
+ @staticmethod
+ def database_process_fn(tmpdir, message_queue):
# This runs in a separate process and provides a clean Tracker database
# exported over D-Bus to the main test process.
@@ -122,7 +122,7 @@ class TrackerSparqlBusTest (ut.TestCase):
conn = Tracker.SparqlConnection.new(
Tracker.SparqlConnectionFlags.NONE,
- Gio.File.new_for_path(self.tmpdir),
+ Gio.File.new_for_path(tmpdir),
Gio.File.new_for_path(cfg.ontologies_dir()),
None)
@@ -139,7 +139,7 @@ class TrackerSparqlBusTest (ut.TestCase):
message_queue = multiprocessing.Queue()
self.process = multiprocessing.Process(target=self.database_process_fn,
- args=(message_queue,))
+ args=(self.tmpdir, message_queue,))
try:
self.process.start()
service_name = message_queue.get()
@@ -161,8 +161,8 @@ class TrackerSparqlBusTest (ut.TestCase):
class TrackerPortalTest(ut.TestCase):
- @classmethod
- def database_process_fn(self, service_name, in_queue, out_queue, dbus_address):
+ @staticmethod
+ def database_process_fn(service_name, in_queue, out_queue, dbus_address):
# This runs in a separate process and provides a clean Tracker database
# exported over D-Bus to the main test process.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]