~lifeless/python-oops-tools/bug-881400

« back to all changes in this revision

Viewing changes to src/oopstools/oops/test/oopsinfestation.txt

  • Committer: Robert Collins
  • Date: 2011-10-13 20:18:51 UTC
  • Revision ID: robertc@robertcollins.net-20111013201851-ym8jmdhoeol3p83s
Export of cruft-deleted tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
= Oops Infestation =
 
2
 
 
3
An OOPS infestation is a group of OOPSes with the same exception type and
 
4
exception value, linked to a Launchpad bug report.
 
5
 
 
6
Let's load OOPSes into the database.
 
7
 
 
8
    >>> from oopstools.oops.helpers import load_database
 
9
    >>> from datetime import date, timedelta
 
10
    >>> start_date = date(2007, 01, 01)
 
11
    >>> load_database(start_date)
 
12
    'Oopses loaded into the database.'
 
13
 
 
14
== Last seen oops ==
 
15
 
 
16
Oops infestations have a convenient method to retrieve the latest oops with the
 
17
same infestation.
 
18
 
 
19
    >>> from oopstools.oops.models import Oops
 
20
    >>> oops = Oops.objects.get(oopsid__exact='OOPS-689S4')
 
21
    >>> oops.oopsinfestation.last_seen_oops
 
22
    <Oops: OOPS-689S4>
 
23
 
 
24
== Frequency report ==
 
25
 
 
26
Oops infestations have a convenient method to retrieve how many oopses have
 
27
happened in the past 7 days with the same infestation.
 
28
 
 
29
    >>> from oopstools.oops import helpers
 
30
    >>> helpers._today = date(2010, 1, 23)
 
31
    >>> oops = Oops.objects.get(oopsid__exact='OOPS-689S4')
 
32
    >>> oops.oopsinfestation.past_week_count
 
33
    0
 
34
 
 
35
= Reset the database =
 
36
 
 
37
    >>> from oopstools.oops.helpers import reset_database
 
38
    >>> reset_database()
 
39
    'Oops, DBOopsRootDirectory and Infestation deleted.'