D-Bus Testing: eliminate TestCmdline.testdir

All D-Bus tests already have their private xdg_root = 'temp-test-dbus'
which is cleared before running each test. Use it also for TestCmdline
instead of creating our own temporary directory, for the sake of
consistency.

Another advantage is that the syncevo-dbus-server is running with that
same XDG root and reading/writing files in it automatically. The
command line client currently *does* send its XDG env variables and
the server uses them, but perhaps that feature will have to be
removed, because it has a design mistake (*), so don't depend on it.

(*) If different clients and the auto-syncing code in the server are
allowed to use different config roots, the 'config name' alone no
longer is a unique identifier for configs.
This commit is contained in:
Patrick Ohly 2012-04-16 12:13:14 +02:00
parent 0e63bc8e59
commit 67ce74b57f
1 changed files with 5 additions and 5 deletions

View File

@ -3525,9 +3525,9 @@ class TestCmdline(unittest.TestCase, DBusUtil):
def setUp(self):
self.setUpServer()
self.testdir = "CmdlineTest"
shutil.rmtree(self.testdir, True)
os.makedirs(self.testdir)
# All tests run with their own XDG root hierarchy.
# Here are the config files.
self.configdir = xdg_root + "/config/syncevolution"
def run(self, result):
self.runTest(result)
@ -3570,8 +3570,8 @@ class TestCmdline(unittest.TestCase, DBusUtil):
"foo: \n" \
"foo:bar2\n"
createFiles(self.testdir, content)
res = scanFiles(self.testdir)
createFiles(self.configdir, content)
res = scanFiles(self.configdir)
self.assertEqualDiff(filtered, res)
randomUUID = "deviceId = syncevolution-blabla\n"
fixedUUID = "deviceId = fixed-devid\n"