46 Commits

Author SHA1 Message Date
Nyall Dawson
7478bca68d [processing] Don't use authid to compare layer CRSes
Instead of QgsCoordinateReferenceSystem == operator, so that we
can correctly test equality of non-standard CRSes
2021-01-11 13:06:05 +10:00
Denis Rouzaud
eddf6feb45 modernize CMakeLists.txt files 2020-11-12 07:14:46 +10:00
Denis Rouzaud
7d1ca81618
improve geometry equality report in tests (#39772)
from https://github.com/qgis/QGIS/pull/8154/files#diff-dbb55b6871a9157f22dc7a979009676cb03f2fadefc557ad0e66a47c92a93503
2020-11-03 09:30:14 +01:00
Alexander Bruy
136c5a4bc2 perform rounding either if field type is numeric or if value was casted
to the number
2020-06-16 08:35:51 +10:00
Sandro Santilli
c23a19793a Set QGIS_CUSTOM_CONFIG_PATH to temporary dir for python tests
Partially fixes #34185
See also #34187
2020-02-03 09:28:38 +01:00
Bas Couwenberg
2628c480c5 Don't include revision in sources.
Prevent changes to files that weren't changed between releases.
This eases review of the changes between releases significantly.
2019-05-17 16:47:47 +02:00
Martin Dobias
ee63cffd88 [processing] Add 'project' to test definition and 'directory' output test
- for algorithms that produce directory output, it is possible to test
  that directory contents are exactly the same (recursively)
- added possibility to have a project file loaded before an algorithm is run
- documented the new additions (+ few existing ones)
2019-04-25 21:40:31 +02:00
Alessandro Pasotti
ed9709b4fa Copy updated test runner into the docker
Handle -e and do not exit on error
2018-11-20 10:31:05 +01:00
Matthias Kuhn
8aca375a6e Add assertGeometriesEqual function for testing 2018-08-21 17:57:14 +02:00
Martin Dobias
c3279ee544 Add a note about version added for new functions in testing module 2018-05-10 14:10:10 -04:00
Martin Dobias
ef145afca6 Add support for unordered comparison of features of layers
This is useful when an algorithm returns features in no particular order
and sorting features by attributes does not help because there may be
features with the same attributes, giving non-unique sorting orders.
2018-05-10 06:50:57 -04:00
Martin Dobias
73d10afe31 Processing tests: allow topological geometry tests instead of exact tests
This is useful with geometry algorithms when the order of the coordinates of produced
geometries does not need to be exactly the same every time, but the output is still
topologically equivalent.
2018-05-10 06:50:57 -04:00
Nyall Dawson
739d4fab09 More verbose test outputs 2018-05-06 19:19:45 +10:00
Matthias Kuhn
7b3308dc4a Improved debug output on test fail 2018-05-02 16:11:08 +02:00
Matthias Kuhn
5f0f8062bc Compare case insensitive 2018-05-02 14:17:59 +02:00
Matthias Kuhn
d9bdedf6d5 testing.checkLayersEqual, assert field names 2018-05-02 11:44:14 +02:00
Nyall Dawson
6dbdbead0c Handle null values in processing attribute tests 2017-11-14 07:14:46 +10:00
Matthias Kuhn
394c53154f Update for nose2 0.7.0 2017-11-05 23:03:16 +01:00
Nyall Dawson
837c1c56eb Fix tests 2017-10-26 08:44:38 +10:00
Nyall Dawson
e9fd409552 Allow multiple primary key fields to be specified for processing tests
`
2017-09-08 16:33:55 +10:00
Nyall Dawson
b87b2fe827 Allow skipping crs check in processing test results
The GML format often requires extra 'hand holding' in order to
get QGIS to detect it's CRS (e.g. GML files created directly
in GDAL will not have an autodetected CRS when pulled into
QGIS). This needs fixing, but as a workaround to allow
processing algorithm porting to continue we can now skip
the crs check for these layers.
2017-08-14 04:56:24 +10:00
Matthias Kuhn
abf768141b More verbose python testing output 2017-08-10 08:03:50 +02:00
Mario Baranzini
78af413dcc Remove python future compatibility layer 2017-08-07 10:27:15 +02:00
Nyall Dawson
d4ad063f45 Allow specifying a 'primary key' field when comparing layers for
processing tests

Some algorithms will return results in different orders, e.g.
due to the use of dicts or other methods which do not guarantee
a fixed return order.

Using a primary key to do the feature match allows us to flexibly
handle these situations and provide tests for these algorithms.
2017-08-05 22:10:18 +10:00
Nyall Dawson
e8d667cac3 Allow testing of layer equality without throwing asserts
Sometimes in tests it's required to check for layer equality without
aborting in case of mismatches
2017-08-05 17:51:38 +10:00
Juergen E. Fischer
c77172ed3d fix more flake8 warnings 2017-03-05 10:21:24 +01:00
Matthias Kuhn
eb7a235dc1 Print messages from QgsMessageLog to the console when testing 2017-01-19 14:41:04 +01:00
Nyall Dawson
1bdb35d630 Avoid key error on fields which should be skipped 2016-12-07 20:13:29 +10:00
Denis Rouzaud
a373f95707 [FEATURE] add functionnality to copy/move feature to move feature map tool 2016-11-15 11:28:47 +01:00
Nyall Dawson
143c18da6f Fix processing tests weren't actually comparing resultant features
.... oops (my fault - copy/paste error)
2016-11-07 09:23:35 +10:00
Juergen E. Fischer
31df84aa6b run 2to3 on source 2016-09-21 23:30:04 +02:00
Nyall Dawson
f449bf2361 Make test layer comparison handle different order of features 2016-08-02 11:53:11 +10:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Matthias Kuhn
c1687abc80 Replace calls to deprecated assertEquals method 2016-05-03 09:18:27 +02:00
Denis Rouzaud
8071acd064 move PyQt compat folder to python/qgis 2016-04-29 14:10:26 +02:00
Denis Rouzaud
ba94896015 fix python testing install directory 2016-04-21 13:54:11 +02:00
Matthias Kuhn
816c322df5 Workaround for buggy mac osx cleanup 2016-04-15 09:20:41 +02:00
Matthias Kuhn
709d3cedd0 Cleanup test application on exit 2016-04-14 12:15:11 +02:00
Matthias Kuhn
3eb7f39281 Geometry testing, reduce default precision 2016-03-27 13:31:15 +02:00
Juergen E. Fischer
f41304637c switch tests to pyqt wrappers 2016-03-21 17:00:26 +01:00
Nyall Dawson
9aabc289ec Indentation 2016-02-28 13:05:51 +11:00
Matthias Kuhn
c79aeba0db Python unittest.expectedFailure improvements
Raises an _UnexpectedSuccess exception
Takes a boolean parameter with a condition under which the test is
expected to fail
2016-02-26 13:40:53 +01:00
Matthias Kuhn
6a8b4075e0 Add method for file comparison to testing lib 2016-02-21 13:13:34 +01:00
Matthias Kuhn
8b84f3adb0 Ignore extra fields on control layer 2016-02-04 17:37:52 +01:00
Matthias Kuhn
70b4f3a242 Don't compare field count 2016-02-04 16:44:11 +01:00
Matthias Kuhn
c21889f945 Add qgis.testing module for generic qgis test helpers 2016-02-04 13:36:13 +01:00