Browse Source

makefile test and pylint file

tags/1.4.0
Etienne Trimaille 3 years ago
parent
commit
fb9587d82a
3 changed files with 268 additions and 56 deletions
  1. 9
    0
      Makefile
  2. 259
    0
      pylintrc
  3. 0
    56
      test/test_main_window_dialog.py

+ 9
- 0
Makefile View File

@@ -1,5 +1,14 @@
1 1
 # Makefile for QuickOSM
2 2
 
3
+test: clean_pyc pep8 test_suite
4
+
5
+test_suite:
6
+	@echo
7
+	@echo "---------------------"
8
+	@echo "Regression Test Suite"
9
+	@echo "---------------------"
10
+	@-export PYTHONPATH=`pwd`:$(PYTHONPATH);export QGIS_DEBUG=0;export QGIS_LOG_FILE=/dev/null;export QGIS_DEBUG_FILE=/dev/null;nosetests -v --with-id --with-coverage --cover-package=core 3>&1 1>&2 2>&3 3>&- || true
11
+
3 12
 i18n_prepare:
4 13
 	@echo Updating strings
5 14
 	@pylupdate4 -noobsolete QuickOSM.pro

+ 259
- 0
pylintrc View File

@@ -0,0 +1,259 @@
1
+[MESSAGES CONTROL]
2
+
3
+# Disable the message, report, category or checker with the given id(s). You
4
+# can either give multiple identifier separated by comma (,) or put this option
5
+# multiple time (only on the command line, not in the configuration file where
6
+# it should appear only once).
7
+disable=R,I,W0404,W0142,W0201,W0212,W0231,W0232,W0403,W0511,E0611,E1103,E1101,C0103,C0111,C0302,W1201,C0325,C1001,super-on-old-class,unpacking-non-sequence
8
+
9
+# Note W0404 should only be disabled on Ole's  home computer running pylint
10
+# version
11
+#disable=R,I,W0142,W0201,W0212,W0231,W0232,W0403,W0404,W0511,E1103,E1101,C0103,C0111,C0302
12
+#pylint 0.23.0,
13
+#astng 0.21.1, common 0.55.0
14
+#Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
15
+#[GCC 4.5.2]
16
+# disable=R,C,I,W1201,W0142,W0201,W0212,W0231,W0232,W0403,W0404,W0511,E1103,E1101,C0103,C0111,C0302,W1201,W0622
17
+
18
+# Enable the message, report, category or checker with the given id(s). You can
19
+# either give multiple identifier separated by comma (,) or put this option
20
+# multiple time.
21
+enable=
22
+
23
+
24
+[MASTER]
25
+
26
+# Specify a configuration file.
27
+#rcfile=
28
+
29
+# Python code to execute, usually for sys.path manipulation such as
30
+# pygtk.require().
31
+#init-hook=
32
+
33
+# Profiled execution.
34
+profile=no
35
+
36
+# Add files or directories to the blacklist. They should be base names, not
37
+# paths.
38
+ignore=resources_rc.py,main_window.py,my_queries.py,osm_file.py,save_query.py,query.py,quick_query.py
39
+
40
+# Pickle collected data for later comparisons.
41
+persistent=yes
42
+
43
+# List of plugins (as comma separated values of python modules names) to load,
44
+# usually to register additional checkers.
45
+load-plugins=
46
+
47
+
48
+[REPORTS]
49
+
50
+# Set the output format. Available formats are text, parseable, colorized, msvs
51
+# (visual studio) and html
52
+output-format=text
53
+
54
+# Include message's id in output
55
+# this option is now deprecated
56
+# include-ids=no
57
+
58
+# Put messages in a separate file for each module / package specified on the
59
+# command line instead of printing them on stdout. Reports (if any) will be
60
+# written in a file name "pylint_global.[txt|html]".
61
+files-output=no
62
+
63
+# Tells whether to display a full report or only the messages
64
+reports=yes
65
+
66
+# Python expression which should return a note less than 10 (10 is the highest
67
+# note). You have access to the variables errors warning, statement which
68
+# respectively contain the number of errors / warnings messages and the total
69
+# number of statements analyzed. This is used by the global evaluation report
70
+# (RP0004).
71
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
72
+
73
+# Add a comment according to your evaluation note. This is used by the global
74
+# evaluation report (RP0004).
75
+comment=no
76
+
77
+
78
+[FORMAT]
79
+
80
+# Maximum number of characters on a single line.
81
+max-line-length=80
82
+
83
+# Maximum number of lines in a module
84
+max-module-lines=1000
85
+
86
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
87
+# tab).
88
+indent-string='    '
89
+
90
+
91
+[VARIABLES]
92
+
93
+# Tells whether we should check for unused import in __init__ files.
94
+init-import=no
95
+
96
+# A regular expression matching the beginning of the name of dummy variables
97
+# (i.e. not used).
98
+dummy-variables-rgx=_|dummy
99
+
100
+# List of additional names supposed to be defined in builtins. Remember that
101
+# you should avoid to define new builtins when possible.
102
+additional-builtins=
103
+
104
+
105
+[SIMILARITIES]
106
+
107
+# Minimum lines number of a similarity.
108
+min-similarity-lines=4
109
+
110
+# Ignore comments when computing similarities.
111
+ignore-comments=yes
112
+
113
+# Ignore docstrings when computing similarities.
114
+ignore-docstrings=yes
115
+
116
+
117
+[BASIC]
118
+
119
+# Required attributes for module, separated by a comma
120
+required-attributes=
121
+
122
+# List of builtins function names that should not be used, separated by a comma
123
+bad-functions=map,filter,apply,input
124
+
125
+# Regular expression which should only match correct module names
126
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
127
+
128
+# Regular expression which should only match correct module level names
129
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
130
+
131
+# Regular expression which should only match correct class names
132
+class-rgx=[A-Z_][a-zA-Z0-9]+$
133
+
134
+# Regular expression which should only match correct function names
135
+function-rgx=[a-z_][a-z0-9_]{2,30}$
136
+
137
+# Regular expression which should only match correct method names
138
+method-rgx=[A-Za-z_][a-z0-9_]{2,30}$
139
+
140
+# Regular expression which should only match correct instance attribute names
141
+attr-rgx=[a-z_][A-Za-z0-9_]{2,30}$
142
+
143
+# Regular expression which should only match correct argument names
144
+argument-rgx=[a-z_][A-Za-z0-9_]{2,30}$
145
+
146
+# Regular expression which should only match correct variable names
147
+variable-rgx=[a-z_][A-Za-z0-9_]{2,30}$
148
+
149
+# Regular expression which should only match correct list comprehension /
150
+# generator expression variable names
151
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
152
+
153
+# Good variable names which should always be accepted, separated by a comma
154
+good-names=i,j,k,ex,Run,_
155
+
156
+# Bad variable names which should always be refused, separated by a comma
157
+bad-names=foo,bar,baz,toto,tutu,tata
158
+
159
+# Regular expression which should only match functions or classes name which do
160
+# not require a docstring
161
+no-docstring-rgx=__.*__
162
+
163
+
164
+[TYPECHECK]
165
+
166
+# Tells whether missing members accessed in mixin class should be ignored. A
167
+# mixin class is detected if its name ends with "mixin" (case insensitive).
168
+ignore-mixin-members=yes
169
+
170
+# List of classes names for which member attributes should not be checked
171
+# (useful for classes with attributes dynamically set).
172
+ignored-classes=SQLObject
173
+
174
+# When zope mode is activated, add a predefined set of Zope acquired attributes
175
+# to generated-members.
176
+zope=no
177
+
178
+# List of members which are set dynamically and missed by pylint inference
179
+# system, and so shouldn't trigger E0201 when accessed. Python regular
180
+# expressions are accepted.
181
+generated-members=REQUEST,acl_users,aq_parent
182
+
183
+
184
+[MISCELLANEOUS]
185
+
186
+# List of note tags to take in consideration, separated by a comma.
187
+notes=FIXME,XXX,TODO
188
+
189
+
190
+[DESIGN]
191
+
192
+# Maximum number of arguments for function / method
193
+max-args=5
194
+
195
+# Argument names that match this expression will be ignored. Default to name
196
+# with leading underscore
197
+ignored-argument-names=_.*
198
+
199
+# Maximum number of locals for function / method body
200
+max-locals=15
201
+
202
+# Maximum number of return / yield for function / method body
203
+max-returns=6
204
+
205
+# Maximum number of branch for function / method body
206
+max-branchs=12
207
+
208
+# Maximum number of statements in function / method body
209
+max-statements=50
210
+
211
+# Maximum number of parents for a class (see R0901).
212
+max-parents=7
213
+
214
+# Maximum number of attributes for a class (see R0902).
215
+max-attributes=7
216
+
217
+# Minimum number of public methods for a class (see R0903).
218
+min-public-methods=2
219
+
220
+# Maximum number of public methods for a class (see R0904).
221
+max-public-methods=20
222
+
223
+
224
+[CLASSES]
225
+
226
+# List of interface methods to ignore, separated by a comma. This is used for
227
+# instance to not check methods defines in Zope's Interface base class.
228
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
229
+
230
+# List of method names used to declare (i.e. assign) instance attributes.
231
+defining-attr-methods=__init__,__new__,setUp
232
+
233
+# List of valid names for the first argument in a class method.
234
+valid-classmethod-first-arg=cls
235
+
236
+
237
+[IMPORTS]
238
+
239
+# Deprecated modules which should not be used, separated by a comma
240
+deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
241
+
242
+# Create a graph of every (i.e. internal and external) dependencies in the
243
+# given file (report RP0402 must not be disabled)
244
+import-graph=
245
+
246
+# Create a graph of external dependencies in the given file (report RP0402 must
247
+# not be disabled)
248
+ext-import-graph=
249
+
250
+# Create a graph of internal dependencies in the given file (report RP0402 must
251
+# not be disabled)
252
+int-import-graph=
253
+
254
+
255
+[EXCEPTIONS]
256
+
257
+# Exceptions that will emit a warning when being caught. Defaults to
258
+# "Exception"
259
+overgeneral-exceptions=Exception

+ 0
- 56
test/test_main_window_dialog.py View File

@@ -1,56 +0,0 @@
1
-# coding=utf-8
2
-"""Dialog test.
3
-
4
-.. note:: This program is free software; you can redistribute it and/or modify
5
-     it under the terms of the GNU General Public License as published by
6
-     the Free Software Foundation; either version 2 of the License, or
7
-     (at your option) any later version.
8
-
9
-"""
10
-
11
-__author__ = 'riccardo.klinger@geolicious.de'
12
-__date__ = '2015-03-26'
13
-__copyright__ = 'Copyright 2015, Riccardo Klinger / Geolicious'
14
-
15
-import unittest
16
-
17
-# This import is to enable SIP API V2
18
-# noinspection PyUnresolvedReferences
19
-import qgis  # pylint: disable=unused-import
20
-from PyQt4.QtGui import QDialogButtonBox, QDialog
21
-from utilities import get_qgis_app
22
-
23
-QGIS_APP, CANVAS, IFACE, PARENT = get_qgis_app()
24
-
25
-from maindialog import MainDialog
26
-
27
-class qgis2web_classDialogTest(unittest.TestCase):
28
-    """Test dialog works."""
29
-
30
-    def setUp(self):
31
-        """Runs before each test."""
32
-        self.dialog = MainDialog(IFACE)
33
-
34
-    def tearDown(self):
35
-        """Runs after each test."""
36
-        self.dialog = None
37
-
38
-    def test_dialog_ok(self):
39
-        """Test we can click OK."""
40
-        button = self.dialog.button_box.button(QDialogButtonBox.Ok)
41
-        button.click()
42
-        result = self.dialog.result()
43
-        self.assertEqual(result, QDialog.Accepted)
44
-
45
-    def test_dialog_cancel(self):
46
-        """Test we can click cancel."""
47
-        button = self.dialog.button_box.button(QDialogButtonBox.Cancel)
48
-        button.click()
49
-        result = self.dialog.result()
50
-        self.assertEqual(result, QDialog.Rejected)
51
-
52
-if __name__ == "__main__":
53
-    suite = unittest.makeSuite(qgis2web_classDialogTest)
54
-    runner = unittest.TextTestRunner(verbosity=2)
55
-    runner.run(suite)
56
-

Loading…
Cancel
Save