Merge lp:~nigelbabu/launchpad/the-return-of-destory-statusexplanation-88545 into lp:launchpad

Proposed by Nigel Babu on 2011-09-13
Status: Merged
Approved by: William Grant on 2011-09-13
Approved revision: no longer in the source branch.
Merged at revision: 13932
Proposed branch: lp:~nigelbabu/launchpad/the-return-of-destory-statusexplanation-88545
Merge into: lp:launchpad
Diff against target: 153 lines (+16/-25)
2 files modified
lib/canonical/launchpad/scripts/ftests/test_oops_prune.py (+12/-18)
lib/canonical/launchpad/scripts/oops.py (+4/-7)
To merge this branch: bzr merge lp:~nigelbabu/launchpad/the-return-of-destory-statusexplanation-88545
Reviewer Review Type Date Requested Status
William Grant code 2011-09-13 Approve on 2011-09-13
Review via email: mp+75099@code.launchpad.net

Commit message

[r=wgrant][bug=88545][incr] Remove the last traces of statusexplantation field.

Description of the change

= Description =
Last traces of statusexplanation which I missed.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/canonical/launchpad/scripts/oops.py
  lib/canonical/launchpad/scripts/ftests/test_oops_prune.py

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/scripts/ftests/test_oops_prune.py'
2--- lib/canonical/launchpad/scripts/ftests/test_oops_prune.py 2011-08-15 09:21:48 +0000
3+++ lib/canonical/launchpad/scripts/ftests/test_oops_prune.py 2011-09-13 01:20:25 +0000
4@@ -48,8 +48,8 @@
5 # whole path rather than the path's basename.
6 self.oops_dir = tempfile.mkdtemp('.directory.with.dots')
7
8- # TODO: This should be in the errorlog tests, and calling into errorlog
9- # methods.
10+ # TODO: This should be in the errorlog tests, and calling into
11+ # errorlog methods.
12 # Create some fake OOPS files
13 self.today = datetime.now(tz=UTC)
14 self.ages_ago = uniquefileallocator.epoch + timedelta(days=1)
15@@ -78,7 +78,6 @@
16 # Need to commit or the changes are not visible on the slave.
17 transaction.commit()
18
19-
20 def tearDown(self):
21 shutil.rmtree(self.oops_dir)
22 shutil.rmtree(config.error_reports.error_dir)
23@@ -98,10 +97,6 @@
24 description='OOPS-1BugDescription666'
25 """)
26 cur.execute("""
27- UPDATE BugTask
28- SET statusexplanation='foo OOPS1BugTaskStatusExplanation666'
29- """)
30- cur.execute("""
31 UPDATE Question SET
32 title='OOPS - 1TicketTitle666 bar',
33 description='http://foo.com OOPS-1TicketDescription666',
34@@ -127,7 +122,6 @@
35 '1MESSAGESUBJECT666',
36 '1BUGTITLE666',
37 '1BUGDESCRIPTION666',
38- '1BUGTASKSTATUSEXPLANATION666',
39 '1TICKETTITLE666',
40 '1TICKETDESCRIPTION666',
41 '1TICKETWHITEBOARD666',
42@@ -167,16 +161,17 @@
43 # doesn't match them.
44 cur = cursor()
45 cur.execute("""
46- UPDATE Bug SET
47- title='Some title',
48- description='https://lp-oops.canonical.com/oops.py/?oopsid=OOPS-1Foo666'
49- """)
50+ UPDATE Bug SET
51+ title='Some title',
52+ description=
53+ 'https://lp-oops.canonical.com/oops.py/?oopsid=OOPS-1Foo666'
54+ """)
55 self.failUnlessEqual(
56 set([self.referenced_oops_code]),
57 referenced_oops())
58
59 def test_script(self):
60- unwanted = unwanted_oops_files(self.oops_dir, 90)
61+ unwanted_oops_files(self.oops_dir, 90)
62 # Commit so our script can see changes made by the setUp method
63 LaunchpadZopelessLayer.commit()
64 process = Popen([
65@@ -196,7 +191,7 @@
66 for dirpath, dirnames, filenames in os.walk(today_dir):
67 for filename in filenames:
68 found_oops_files.add(
69- path_to_oopsid(os.path.join(dirpath,filename))
70+ path_to_oopsid(os.path.join(dirpath, filename))
71 )
72 today_day_count = (self.today - uniquefileallocator.epoch).days + 1
73 self.failUnlessEqual(
74@@ -232,9 +227,8 @@
75 'Script failed to remove 2006-01-03 directory'
76 )
77
78-
79 def test_script_dryrun(self):
80- unwanted = unwanted_oops_files(self.oops_dir, 90)
81+ unwanted_oops_files(self.oops_dir, 90)
82 # Commit so our script can see changes made by the setUp method
83 LaunchpadZopelessLayer.commit()
84
85@@ -270,7 +264,7 @@
86 def test_script_default_error_dir(self):
87 # Verify that the script runs without the error_dir argument.
88 default_error_dir = config.error_reports.error_dir
89- unwanted = unwanted_oops_files(default_error_dir, 90)
90+ unwanted_oops_files(default_error_dir, 90)
91 # Commit so our script can see changes made by the setUp method.
92 LaunchpadZopelessLayer.commit()
93 process = Popen([
94@@ -288,7 +282,7 @@
95 # And a directory empty of OOPS reports, but with some rubbish
96 os.mkdir(os.path.join(self.oops_dir, '2001-12-02'))
97 open(
98- os.path.join( self.oops_dir, '2001-12-02', 'foo'), 'w'
99+ os.path.join(self.oops_dir, '2001-12-02', 'foo'), 'w'
100 ).write('foo')
101
102 prune_empty_oops_directories(self.oops_dir)
103
104=== modified file 'lib/canonical/launchpad/scripts/oops.py'
105--- lib/canonical/launchpad/scripts/oops.py 2011-08-15 09:21:48 +0000
106+++ lib/canonical/launchpad/scripts/oops.py 2011-09-13 01:20:25 +0000
107@@ -37,7 +37,8 @@
108 # Note that the POSIX regexp syntax is subtly different to the Python,
109 # and that we need to escape all \ characters to keep the SQL interpreter
110 # happy.
111- posix_oops_match = r"~* '^(oops\\s*-?\\s*\\d*[a-z]+\\d+)|[^=]+(\\moops\\s*-?\\s*\\d*[a-z]+\\d+)'"
112+ posix_oops_match = (r"~* '^(oops\\s*-?\\s*\\d*[a-z]+\\d+)"
113+ "|[^=]+(\\moops\\s*-?\\s*\\d*[a-z]+\\d+)'")
114 query = """
115 SELECT DISTINCT subject FROM Message
116 WHERE subject %(posix_oops_match)s AND subject IS NOT NULL
117@@ -48,14 +49,11 @@
118 FROM Bug WHERE title %(posix_oops_match)s
119 OR description %(posix_oops_match)s
120 UNION ALL
121- SELECT statusexplanation FROM BugTask
122- WHERE statusexplanation %(posix_oops_match)s
123- UNION ALL
124 SELECT title || ' ' || description || ' ' || COALESCE(whiteboard,'')
125 FROM Question WHERE title %(posix_oops_match)s
126 OR description %(posix_oops_match)s
127 OR whiteboard %(posix_oops_match)s
128- """ % vars()
129+ """ % {'posix_oops_match': posix_oops_match}
130
131 referenced_codes = set()
132
133@@ -63,7 +61,6 @@
134 cur = cursor()
135 cur.execute(query)
136 for content in (row[0] for row in cur.fetchall()):
137- found = False
138 for match in FormattersAPI._re_linkify.finditer(content):
139 if match.group('oops') is not None:
140 code_string = match.group('oopscode')
141@@ -133,6 +130,7 @@
142 ) is not None:
143 yield os.path.join(dirpath, filename)
144
145+
146 def prune_empty_oops_directories(root_path):
147 for filename in os.listdir(root_path):
148 if re.search(r'^\d\d\d\d-\d\d-\d\d$', filename) is None:
149@@ -143,4 +141,3 @@
150 if os.listdir(path):
151 continue
152 os.rmdir(path)
153-