Merge lp:~thisfred/desktopcouch/fix_tests_yet_again into lp:desktopcouch

Proposed by Eric Casteleijn
Status: Merged
Approved by: John O'Brien
Approved revision: 58
Merged at revision: not available
Proposed branch: lp:~thisfred/desktopcouch/fix_tests_yet_again
Merge into: lp:desktopcouch
Diff against target: None lines
To merge this branch: bzr merge lp:~thisfred/desktopcouch/fix_tests_yet_again
Reviewer Review Type Date Requested Status
John O'Brien (community) Approve
Facundo Batista (community) Approve
Review via email: mp+11488@code.launchpad.net

Commit message

Correctly chains .ini files, and fix one test that talked to the system couchdb on port 5984.

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

This corrects the command line switches to chain the ini files correctly. Turns out that was never done correctly before. That's ok because this made us find a bug in couchdb itself. This code should work with the current version of couchdb, although it may not yet do the right thing completely. For that we need a newer version of the 0.10 branch of couchdb packaged which has a fix.

I also made the create contacts script talk to desktopcouch instead of the system couchdb.

Revision history for this message
Facundo Batista (facundo) wrote :

Looks ok, but you should place a comment in the import/reload stuff in __init__.py

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

> Looks ok, but you should place a comment in the import/reload stuff in
> __init__.py

thanks will do!

Revision history for this message
John O'Brien (jdobrien) :
review: Approve
59. By Eric Casteleijn

added a comment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'desktopcouch/__init__.py'
2--- desktopcouch/__init__.py 2009-09-01 00:38:53 +0000
3+++ desktopcouch/__init__.py 2009-09-09 23:24:53 +0000
4@@ -16,7 +16,7 @@
5 "Desktop Couch helper files"
6
7 from __future__ import with_statement
8-import os, re, time
9+import os, re
10 from desktopcouch.start_local_couchdb import process_is_couchdb, read_pidfile
11
12 def find_pid(start_if_not_running=True):
13
14=== modified file 'desktopcouch/contacts/testing/create.py'
15--- desktopcouch/contacts/testing/create.py 2009-09-04 08:59:18 +0000
16+++ desktopcouch/contacts/testing/create.py 2009-09-09 23:24:53 +0000
17@@ -22,6 +22,7 @@
18 import random, string, uuid
19
20 from couchdb import Server
21+import desktopcouch
22
23 CONTACT_DOCTYPE = 'http://www.freedesktop.org/wiki/Specifications/desktopcouch/contact'
24 COUCHDB_SYS_PORT = 5984
25@@ -158,9 +159,12 @@
26 return fielddict
27
28 def create_many_contacts(
29- num_contacts=10, host='localhost', port=COUCHDB_SYS_PORT,
30+ num_contacts=10, host='localhost', port=None,
31 db_name='contacts', doctype=CONTACT_DOCTYPE, app_annots=None):
32 """Make many contacts and create their records"""
33+ if port is None:
34+ desktopcouch.find_pid()
35+ port = desktopcouch.find_port()
36 server_url = 'http://%s:%s/' % (host, port)
37 server = Server(server_url)
38 db = server[db_name] if db_name in server else server.create(db_name)
39
40=== modified file 'desktopcouch/local_files.py'
41--- desktopcouch/local_files.py 2009-09-02 15:28:28 +0000
42+++ desktopcouch/local_files.py 2009-09-09 23:24:53 +0000
43@@ -67,7 +67,8 @@
44 import distutils.version
45 if distutils.version.LooseVersion(couchversion) >= \
46 distutils.version.LooseVersion('0.10'):
47- chain = '-a'
48+ # XXX: hardcoded path, won't work when couch is somewhere else.
49+ chain = '-n -a /etc/couchdb/default.ini -a'
50 else:
51 chain = '-C'
52
53@@ -78,7 +79,8 @@
54 super(Exception, self).__init__()
55 self.file_name = file_name
56 def __str__(self):
57- return "OAuth details were not found in the ini file (%s)" % self.file_name
58+ return "OAuth details were not found in the ini file (%s)" % (
59+ self.file_name)
60
61 def get_oauth_tokens(config_file_name=FILE_INI):
62 """Return the OAuth tokens from the desktop Couch ini file.
63@@ -136,4 +138,3 @@
64 # You will need to add -b or -k on the end of this
65 COUCH_EXEC_COMMAND = [COUCH_EXE, couch_chain_flag(), FILE_INI, '-p', FILE_PID,
66 '-o', FILE_STDOUT, '-e', FILE_STDERR]
67-
68
69=== modified file 'desktopcouch/records/server.py'
70--- desktopcouch/records/server.py 2009-09-01 15:12:14 +0000
71+++ desktopcouch/records/server.py 2009-09-09 23:24:53 +0000
72@@ -247,7 +247,7 @@
73 """
74 view_name = "get_records_and_type"
75 view_map_js = """
76- function(doc) {
77+ function(doc) {
78 try {
79 if (! doc['application_annotations']['Ubuntu One']
80 ['private_application_annotations']['deleted']) {
81
82=== modified file 'desktopcouch/tests/__init__.py'
83--- desktopcouch/tests/__init__.py 2009-09-03 14:24:06 +0000
84+++ desktopcouch/tests/__init__.py 2009-09-09 23:24:53 +0000
85@@ -33,4 +33,5 @@
86
87 import xdg.BaseDirectory
88 reload(xdg.BaseDirectory)
89-
90+from desktopcouch import local_files
91+reload(local_files)
92
93=== modified file 'desktopcouch/tests/test_start_local_couchdb.py'
94--- desktopcouch/tests/test_start_local_couchdb.py 2009-09-02 22:15:09 +0000
95+++ desktopcouch/tests/test_start_local_couchdb.py 2009-09-09 23:24:53 +0000
96@@ -71,7 +71,6 @@
97
98 def setUp(self):
99 # create temp folder with databases and design documents in
100- os.mkdir(os.path.join(xdg_data, "desktop-couch"))
101 for d in DIRS:
102 os.mkdir(os.path.join(xdg_data, "desktop-couch", d))
103 for f, data in FILES.items():

Subscribers

People subscribed via source and target branches