Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/misc/bug.py
4036 views
1
"""
2
Bug reporting
3
"""
4
5
def bug():
6
r"""
7
Simple script for putting a bug report in a standard format.
8
9
EXAMPLES:
10
` sage: bug() # not tested
11
We will now create a bug report in a standard format.
12
Bug in command (one line)? bug
13
Expected output (one line)? bugs
14
Output you got (one line)? bug report
15
Comments or suggestions (one line)? help!
16
******************************
17
Please copy and paste the following output into an email (edit
18
it further) and send it to [email protected].
19
******************************
20
From: was
21
Machine specs: Linux sha 2.6.16.16 #15 SMP Sun May 14 12:40:14 PDT 2006 i686
22
Date: 2006-05-14
23
Bug in command (one line): bug
24
Exected output: bugs
25
Got instead: bug report
26
Comments: help!
27
28
AUTHOR: David Joyner (2006-05)
29
"""
30
print "We will now create a bug report in a standard format."
31
import os
32
import time
33
report = """
34
******************************
35
Please copy and paste the following output into an email (edit
36
it further) and send it to [email protected].
37
******************************
38
\n"""
39
try:
40
lgn = os.getlogin()
41
except OSError:
42
lgn = os.popen('whoami').read().strip()
43
try:
44
unm = os.uname()
45
except OSError:
46
unm = "unknown machine"
47
tm = time.strftime('%Y-%m-%d')
48
report = report+"From: "+lgn+"\n"
49
report = report+"Machine specs: %s\n"%(' '.join(unm))
50
report = report+"Date: %s \n"%tm
51
report = report + "\n Bug in command (one line): "
52
try:
53
command = raw_input("Bug in command (one line)? ")
54
report = report + command + "\n Exected output: "
55
expected = raw_input("Expected output (one line)? ")
56
report = report + expected + "\n Got instead: "
57
got = raw_input("Output you got (one line)? ")
58
report = report + got + "\n Comments: "
59
comments = raw_input("Comments or suggestions (one line)? ")
60
report = report + comments + "\n"
61
except (EOFError, KeyboardInterrupt):
62
print "Creation of bug report cancelled."
63
print "Type bug() to create the report again."
64
print report
65
66
67