On Wed, 2012-04-18 at 12:51 +0200, Krzesimir Nowak wrote:
> I added some more tests, they are as usual on my branch:
> https://meego.gitorious.org/~krnowak/meego-middleware/krnowaks-syncevolution/commits/cmdline-tests-master
When you move tests, can you also copy the comments associated with
them? For example:
void testPrintFileTemplates() {
// use local copy of templates in build dir (no need to install)
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "./templates");
The comment in the C++ version explains (briefly) what "./templates" is
meant to be: the "src/templates" that gets created in the build
directory. The (admittedly undocumented) assumption is that test-dbus.py
will always be run there.
The Python version replicates that without the comment:
# TODO: this test works, but I do not know what are the assumptions behind it.
@property("ENV", "SYNCEVOLUTION_TEMPLATE_DIR=./templates")
@property("debug", False)
def testPrintFileTemplates(self):
"""TestCmdline.testPrintFileTemplates - print file templates"""
self.doPrintFileTemplates()
> testPrintFileTemplatesConfig is fishy for me and fails with an error
> for now. There is a TODO about it. Could you look at it?
The Python version doesn't quite match the C++ version. self.configdir =
$XDG_CONFIG_HOME/syncevolution != m_testDir = $XDG_CONFIG_HOME.
Here's a patch which makes the test work:
diff --git a/test/test-dbus.py b/test/test-dbus.py
index 5adea8f..fafe974 100755
--- a/test/test-dbus.py
+++ b/test/test-dbus.py
@@ -4379,19 +4379,30 @@ sources/todo/config.ini:# databasePassword = '''.format(
self.assertEqualDiff(filterConfig(internalToIni(self.FunambolConfig())),
injectValues(filterConfig(out)))
-# TODO: this test works, but I do not know what are the assumptions behind it.
+ # Use local copy of templates in build dir (no need to install);
+ # this assumes that test-dbus.py is run in the build "src"
+ # directory.
@property("ENV", "SYNCEVOLUTION_TEMPLATE_DIR=./templates")
@property("debug", False)
def testPrintFileTemplates(self):
"""TestCmdline.testPrintFileTemplates - print file templates"""
self.doPrintFileTemplates()
+ # Disable reading default templates, rely on finding the user
+ # ones (set up below via symlink).
@property("ENV", "SYNCEVOLUTION_TEMPLATE_DIR=/dev/null")
@property("debug", False)
def testPrintFileTemplatesConfig(self):
- """TestCmdline.testPrintFileTemplatesConfig - print file templates
config"""
-# TODO: This "../templates" looks fishy. I do not know what are the
assumptions behind it.
- os.symlink("../templates", self.configdir + "/syncevolution-templates")
+ """TestCmdline.testPrintFileTemplatesConfig - print file templates
from user home directory"""
+ # The user's "home directory" or more precisely, his
+ # XDG_CONFIG_HOME, is set to xdg_root + "config". Make sure
+ # that there is a "syncevolution-templates" with valid
+ # templates in that "config" directory, because "templates"
+ # will not be found otherwise (SYNCEVOLUTION_TEMPLATE_DIR
+ # doesn't point to it).
+ os.makedirs(xdg_root + "/config")
+ # Use same "./templates" as in testPrintFileTemplates().
+ os.symlink("../../templates", xdg_root +
"/config/syncevolution-templates")
self.doPrintFileTemplates()
@property("debug", False)
> Also, there are some TODOs in testSync. Maybe some --print-config +
> some parameters could mimick the C++ code there?
I think the parts marked with TODO are examples of tests that better
stays in Cmdline.cpp because they are true unit tests (cover internal
implementation aspects).
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution