From 2db11763d50b2295ab49b44c5ed0adee38ad67fe Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 14 Apr 2019 19:20:38 +0900 Subject: tests/testutils/artifactshare.py: Add message handler This needs to be added along with the status messages added to the artifact cache, and this detail diverges from master. This is because we have not bothered to backport !1071 which refactors the CASCache to be a delegate object of the ArtifactCache istead of a derived class - backporting !1071 would allow us to remove these message handlers because the CAS server and test fixture only use the CASCache object directly, not the business logic in the ArtifactCache. --- tests/testutils/artifactshare.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py index 71aac534b..c7987e02c 100644 --- a/tests/testutils/artifactshare.py +++ b/tests/testutils/artifactshare.py @@ -2,6 +2,7 @@ import string import pytest import subprocess import os +import sys import shutil import signal from collections import namedtuple @@ -49,6 +50,7 @@ class ArtifactShare(): context = Context() context.artifactdir = self.repodir + context.set_message_handler(self._message_handler) self.cas = context.artifactcache @@ -166,6 +168,13 @@ class ArtifactShare(): f_bavail=self.free_space - repo_size, f_bsize=1) + def _message_handler(self, message, context): + # We need a message handler because this will own an ArtifactCache + # which can in turn fire messages. + + # Just unconditionally print the messages to stderr + print(message.message, file=sys.stderr) + # create_artifact_share() # -- cgit v1.2.1