Skip to contentSkip to conversation

master - lvmdbustest: Move std_err_print to testlib

PATCH tasleson 1 participant 1 message Nov 17, 2016

lore
Share & tools
lore

tasleson

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bfedeb748149c61caab44957c0a4f54fe57d6823
Commit:        bfedeb748149c61caab44957c0a4f54fe57d6823
Parent:        99806ec7ec88c8cade16838ff1c9155fcc861b7e
Author:        Tony Asleson <[email protected]>
AuthorDate:    Thu Nov 17 10:32:55 2016 -0600
Committer:     Tony Asleson <[email protected]>
CommitterDate: Thu Nov 17 11:35:16 2016 -0600

lvmdbustest: Move std_err_print to testlib

So we can re-use it in the testlib too.

---
 test/dbus/lvmdbustest.py |    9 ++-------
 test/dbus/testlib.py     |    6 ++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
test/dbus/lvmdbustest.py +2 -7
index c1cfb0f..8b5c4fd 100755
@@ -14,10 +14,10 @@ import dbus
 # noinspection PyUnresolvedReferences
 from dbus.mainloop.glib import DBusGMainLoop
 import unittest
-import sys
 import time
 import pyudev
 from testlib import *
+import testlib
 
 g_tmo = 0
 
@@ -44,12 +44,7 @@ else:
 # validation to limit the massive amount of introspection calls we make as
 # that method prevents things from executing concurrently
 if pv_device_list:
-	validate_introspection = False
-
-
-def std_err_print(*args):
-	sys.stderr.write(' '.join(map(str, args)) + '\n')
-	sys.stderr.flush()
+	testlib.validate_introspection = False
 
 
 def vg_n():
test/dbus/testlib.py +6 -0
index de61361..e0c26a8 100644
@@ -15,6 +15,7 @@ import xml.etree.ElementTree as Et
 from collections import OrderedDict
 import dbus
 import os
+import sys
 
 BUS_NAME = os.getenv('LVM_DBUS_NAME', 'com.redhat.lvmdbus1')
 BASE_INTERFACE = 'com.redhat.lvmdbus1'
@@ -43,6 +44,11 @@ def mib(s):
 	return 1024 * 1024 * s
 
 
+def std_err_print(*args):
+	sys.stderr.write(' '.join(map(str, args)) + '\n')
+	sys.stderr.flush()
+
+
 class DbusIntrospection(object):
 	@staticmethod
 	def introspect(xml_representation):