Skip to content

Commit

Permalink
Merge branch 'master' into snapping-fixes, resolve conflict with #36511
Browse files Browse the repository at this point in the history
… by keeping its solution
  • Loading branch information
uclaros committed May 22, 2020
2 parents 856627b + 25e24e7 commit 85d0956
Show file tree
Hide file tree
Showing 1,959 changed files with 69,265 additions and 30,086 deletions.
2 changes: 1 addition & 1 deletion .ci/azure-pipelines/azure-pipelines.yml
@@ -1,7 +1,7 @@
variables:
LR: release-3_12
LTR: release-3_10
CTEST_CUSTOM_TESTS_IGNORE: "ProcessingGdalAlgorithmsRasterTest;ProcessingGdalAlgorithmsVectorTest;ProcessingGrass7AlgorithmsImageryTest;ProcessingGrass7AlgorithmsRasterTest;ProcessingGrass7AlgorithmsVectorTest;ProcessingGuiTest;ProcessingOtbAlgorithmsTest;ProcessingQgisAlgorithmsTestPt1;ProcessingQgisAlgorithmsTestPt2;ProcessingQgisAlgorithmsTestPt3;ProcessingQgisAlgorithmsTestPt4;ProcessingScriptUtilsTest;PyQgsAnnotation;PyQgsAppStartup;PyQgsAuthManagerOAuth2OWSTest;PyQgsAuthManagerPasswordOWSTest;PyQgsAuthManagerPKIOWSTest;PyQgsAuthManagerProxy;PyQgsAuthSettingsWidget;PyQgsAuxiliaryStorage;PyQgsBlockingNetworkRequest;PyQgsExifTools;PyQgsFileDownloader;PyQgsFileUtils;PyQgsGeometryTest;PyQgsImageCache;PyQgsImportIntoPostGIS;PyQgsLayoutAtlas;PyQgsLayoutLegend;PyQgsLayoutMap;PyQgsLayoutMapGrid;PyQgsMapLayer;PyQgsOfflineEditingWFS;PyQgsOGRProvider;PyQgsOGRProviderGpkg;PyQgsOGRProviderSqlite;PyQgsPalLabelingCanvas;PyQgsPalLabelingLayout;PyQgsPalLabelingPlacement;PyQgsPointDisplacementRenderer;PyQgsProject;PyQgsProviderConnectionGpkg;PyQgsProviderConnectionPostgres;PyQgsPythonProvider;PyQgsRasterFileWriter;PyQgsRasterLayer;PyQgsSelectiveMasking;PyQgsServerAccessControlWMSGetlegendgraphic;PyQgsServerApi;PyQgsServerCacheManager;PyQgsServerLocaleOverride;PyQgsServerSecurity;PyQgsServerSettings;PyQgsServerWMS;PyQgsServerWMSDimension;PyQgsServerWMSGetFeatureInfo;PyQgsServerWMSGetLegendGraphic;PyQgsServerWMSGetMap;PyQgsServerWMSGetPrint;PyQgsServerWMTS;PyQgsSettings;PyQgsShapefileProvider;PyQgsSpatialiteProvider;PyQgsSvgCache;PyQgsSymbolLayer;PyQgsTaskManager;PyQgsTextRenderer;PyQgsVectorFileWriter;PyQgsVectorLayer;PyQgsVectorLayerUtils;PyQgsVirtualLayerProvider;PyQgsWFSProviderGUI;PyQgsZipUtils;qgis_3drenderingtest;qgis_alignrastertest;qgis_arcgisrestutilstest;qgis_banned_keywords;qgis_browsermodeltest;qgis_callouttest;qgis_compositionconvertertest;qgis_coordinatereferencesystemtest;qgis_datadefinedsizelegendtest;qgis_datumtransformdialog;qgis_diagramtest;qgis_doxygen_order;qgis_dxfexporttest;qgis_expressiontest;qgis_filedownloader;qgis_geometrycheckstest;qgis_geometrytest;qgis_geonodeconnectiontest;qgis_grassprovidertest7;qgis_imagecachetest;qgis_invertedpolygonrenderertest;qgis_labelingenginetest;qgis_layerdefinitiontest;qgis_layout3dmaptest;qgis_layouthtmltest;qgis_layoutlabeltest;qgis_layoutmapgridtest;qgis_layoutmaptest;qgis_layoutpicturetest;qgis_layoutscalebartest;qgis_layouttabletest;qgis_legendrenderertest;qgis_licenses;qgis_maprendererjobtest;qgis_maprotationtest;qgis_mapsettingsutilstest;qgis_maptooladdfeatureline;qgis_mimedatautilstest;qgis_networkaccessmanagertest;qgis_openclutilstest;qgis_painteffecttest;qgis_pallabelingtest;qgis_processingtest;qgis_projecttest;qgis_qgisappclipboard;qgis_rasterlayersaveasdialog;qgis_shellcheck;qgis_sipify;qgis_sip_include;qgis_sip_uptodate;qgis_spelling;qgis_styletest;qgis_svgcachetest;qgis_taskmanagertest;qgis_transformdialog;qgis_vectorfilewritertest;qgis_wcsprovidertest;qgis_ziplayertest;qgis_meshcalculator;qgis_pointlocatortest;PyQgsExpressionBuilderWidget;PyQgsDatumTransform;qgis_vertextool;PyQgsCoordinateOperationWidget;PyQgsProviderConnectionSpatialite;qgis_maptoolsplitpartstest;qgis_vectortilelayertest"
CTEST_CUSTOM_TESTS_IGNORE: "ProcessingGdalAlgorithmsRasterTest;ProcessingGdalAlgorithmsVectorTest;ProcessingGrass7AlgorithmsImageryTest;ProcessingGrass7AlgorithmsRasterTest;ProcessingGrass7AlgorithmsVectorTest;ProcessingGuiTest;ProcessingOtbAlgorithmsTest;ProcessingQgisAlgorithmsTestPt1;ProcessingQgisAlgorithmsTestPt2;ProcessingQgisAlgorithmsTestPt3;ProcessingQgisAlgorithmsTestPt4;ProcessingScriptUtilsTest;PyQgsAnnotation;PyQgsAppStartup;PyQgsAuthManagerOAuth2OWSTest;PyQgsAuthManagerPasswordOWSTest;PyQgsAuthManagerPKIOWSTest;PyQgsAuthManagerProxy;PyQgsAuthSettingsWidget;PyQgsAuxiliaryStorage;PyQgsBlockingNetworkRequest;PyQgsExifTools;PyQgsFileDownloader;PyQgsFileUtils;PyQgsGeometryTest;PyQgsImageCache;PyQgsImportIntoPostGIS;PyQgsLayoutAtlas;PyQgsLayoutLegend;PyQgsLayoutMap;PyQgsLayoutMapGrid;PyQgsMapLayer;PyQgsOfflineEditingWFS;PyQgsOGRProvider;PyQgsOGRProviderGpkg;PyQgsOGRProviderSqlite;PyQgsPalLabelingCanvas;PyQgsPalLabelingLayout;PyQgsPalLabelingPlacement;PyQgsPointDisplacementRenderer;PyQgsProject;PyQgsProviderConnectionGpkg;PyQgsProviderConnectionPostgres;PyQgsPythonProvider;PyQgsRasterFileWriter;PyQgsRasterLayer;PyQgsSelectiveMasking;PyQgsServerAccessControlWMSGetlegendgraphic;PyQgsServerApi;PyQgsServerCacheManager;PyQgsServerLocaleOverride;PyQgsServerSecurity;PyQgsServerSettings;PyQgsServerWMS;PyQgsServerWMSDimension;PyQgsServerWMSGetFeatureInfo;PyQgsServerWMSGetLegendGraphic;PyQgsServerWMSGetMap;PyQgsServerWMSGetPrint;PyQgsServerWMTS;PyQgsSettings;PyQgsShapefileProvider;PyQgsSpatialiteProvider;PyQgsSvgCache;PyQgsSymbolLayer;PyQgsTaskManager;PyQgsTextRenderer;PyQgsVectorFileWriter;PyQgsVectorLayer;PyQgsVectorLayerUtils;PyQgsVirtualLayerProvider;PyQgsWFSProviderGUI;PyQgsZipUtils;qgis_3drenderingtest;qgis_alignrastertest;qgis_arcgisrestutilstest;qgis_banned_keywords;qgis_browsermodeltest;qgis_callouttest;qgis_compositionconvertertest;qgis_coordinatereferencesystemtest;qgis_datadefinedsizelegendtest;qgis_datumtransformdialog;qgis_diagramtest;qgis_doxygen_order;qgis_dxfexporttest;qgis_expressiontest;qgis_filedownloader;qgis_geometrycheckstest;qgis_geometrytest;qgis_geonodeconnectiontest;qgis_grassprovidertest7;qgis_imagecachetest;qgis_invertedpolygonrenderertest;qgis_labelingenginetest;qgis_layerdefinitiontest;qgis_layout3dmaptest;qgis_layouthtmltest;qgis_layoutlabeltest;qgis_layoutmapgridtest;qgis_layoutmaptest;qgis_layoutpicturetest;qgis_layoutscalebartest;qgis_layouttabletest;qgis_legendrenderertest;qgis_licenses;qgis_defwindowtitle;qgis_maprendererjobtest;qgis_maprotationtest;qgis_mapsettingsutilstest;qgis_maptooladdfeatureline;qgis_mimedatautilstest;qgis_networkaccessmanagertest;qgis_openclutilstest;qgis_painteffecttest;qgis_pallabelingtest;qgis_processingtest;qgis_projecttest;qgis_qgisappclipboard;qgis_rasterlayersaveasdialog;qgis_shellcheck;qgis_sipify;qgis_sip_include;qgis_sip_uptodate;qgis_spelling;qgis_styletest;qgis_svgcachetest;qgis_taskmanagertest;qgis_transformdialog;qgis_vectorfilewritertest;qgis_wcsprovidertest;qgis_ziplayertest;qgis_meshcalculator;qgis_pointlocatortest;PyQgsExpressionBuilderWidget;PyQgsDatumTransform;qgis_vertextool;PyQgsCoordinateOperationWidget;PyQgsProviderConnectionSpatialite;qgis_maptoolsplitpartstest;qgis_vectortilelayertest;qgis_ogrproviderguitest"
Agent.Source.Git.ShallowFetchDepth: 120

trigger:
Expand Down
12 changes: 10 additions & 2 deletions .ci/travis/linux/scripts/docker-qgis-test.sh
Expand Up @@ -10,6 +10,9 @@ set -e
############################
# Restore postgres test data
############################
echo "travis_fold:start:postgres"
echo "${bold}Load Postgres database...🐘${endbold}"

printf "[qgis_test]\nhost=postgres\nport=5432\ndbname=qgis_test\nuser=docker\npassword=docker" > ~/.pg_service.conf
export PGUSER=docker
export PGHOST=postgres
Expand All @@ -30,26 +33,31 @@ echo "Restoring postgres test data ..."
/root/QGIS/tests/testdata/provider/testdata_pg.sh
echo "Postgres test data restored ..."
popd > /dev/null # /root/QGIS
echo "travis_fold:end:postgres"

##############################
# Restore Oracle test data
##############################

echo "travis_fold:start:oracle"
echo "${bold}Load Oracle database...🙏${endbold}"

export ORACLE_HOST="oracle"
export QGIS_ORACLETEST_DBNAME="${ORACLE_HOST}/XEPDB1"
export QGIS_ORACLETEST_DB="host=${QGIS_ORACLETEST_DBNAME} port=1521 user='QGIS' password='qgis'"

echo "Wait a moment while loading Oracle database."
while ! echo exit | sqlplus -L SYSTEM/adminpass@$QGIS_ORACLETEST_DBNAME &> /dev/null
do
printf "."
printf "🙏"
sleep 1
done
echo " done"
echo " done 👀"

pushd /root/QGIS > /dev/null
/root/QGIS/tests/testdata/provider/testdata_oracle.sh $ORACLE_HOST
popd > /dev/null # /root/QGIS
echo "travis_fold:end:oracle"

# this is proving very flaky:

Expand Down
3 changes: 3 additions & 0 deletions .ci/travis/linux/scripts/test_blacklist.txt
Expand Up @@ -23,3 +23,6 @@ qgis_layerdefinition

# MSSQL requires the MSSQL docker
PyQgsProviderConnectionMssql

# Broken - segfaults on Travis, likely due to a real issue in the server code
PyQgsServerWMSGetPrint
11 changes: 6 additions & 5 deletions .ci/travis/scripts/ctest2travis.py
Expand Up @@ -77,13 +77,14 @@ def start_test_fold():
updated_line = line.decode('utf-8')
if re.match('Run dashboard with model Experimental', updated_line):
start_fold('build')
updated_line = '{title}\n{line}'.format(title=colored('Running tests...', 'yellow', attrs=['bold']), line=updated_line)
updated_line = '{title}\n{line}'.format(title=colored('Running tests...', 'yellow', attrs=['bold']),
line=updated_line)

elif re.match('Test project /home/travis/build/qgis/QGIS/build', updated_line):
end_fold() # tag=build
end_fold() # tag=build
start_test_fold()

if re.search('\*\*\*Failed', updated_line) or re.search('\*\*\*Timeout', updated_line):
if re.search(r'\*\*\*Failed', updated_line) or re.search(r'\*\*\*Timeout', updated_line):
end_fold()
updated_line = colored(updated_line, 'red')
in_failing_test = True
Expand All @@ -97,14 +98,14 @@ def start_test_fold():
in_failure = False
else:
updated_line = colored(updated_line, 'yellow')
elif re.search('\*\*\* Segmentation fault', updated_line):
elif re.search(r'\*\*\* Segmentation fault', updated_line):
start_fold('segfault')
updated_line = colored(updated_line, 'magenta')
elif re.match(' Test failed: Segmentation fault', updated_line):
end_fold()

else:
if re.match('(FAIL|ERROR)[:\!].*', updated_line):
if re.match(r'(FAIL|ERROR)[:\!].*', updated_line):
updated_line = colored(updated_line, 'yellow')
in_failure = True

Expand Down
4 changes: 2 additions & 2 deletions .ci/travis/scripts/pr_has_label.py
Expand Up @@ -2,7 +2,7 @@

import sys
import json
from urllib.request import urlopen # using urllib since it is a standard module (vs. requests)
from urllib.request import urlopen # using urllib since it is a standard module (vs. requests)
from urllib.error import URLError
import argparse

Expand All @@ -23,7 +23,7 @@
try:
data = urlopen(url).read().decode('utf-8')
except URLError as err:
print("URLError: ".format(err.reason))
print("URLError: {}".format(err.reason))
sys.exit(1)

obj = json.loads(data)
Expand Down
1 change: 1 addition & 0 deletions .docker/qgis.dockerfile
Expand Up @@ -37,6 +37,7 @@ RUN cmake \
-DWITH_SERVER=ON \
-DWITH_3D=ON \
-DWITH_BINDINGS=ON \
-DWITH_CUSTOM_WIDGETS=ON \
-DBINDINGS_GLOBAL_INSTALL=ON \
-DWITH_STAGED_PLUGINS=ON \
-DWITH_GRASS=ON \
Expand Down
@@ -1,4 +1,4 @@
FROM ubuntu:19.04
FROM ubuntu:20.04
MAINTAINER Denis Rouzaud <denis@opengis.ch>

LABEL Description="Docker container with QGIS dependencies" Vendor="QGIS.org" Version="1.0"
Expand Down Expand Up @@ -132,9 +132,9 @@ ENV LD_LIBRARY_PATH="/instantclient_19_3:${LD_LIBRARY_PATH}"

# MSSQL: client side
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
RUN curl https://packages.microsoft.com/config/ubuntu/19.04/prod.list | tee /etc/apt/sources.list.d/msprod.list
RUN apt-get update
RUN ACCEPT_EULA=Y apt-get install -y msodbcsql17 mssql-tools
RUN ACCEPT_EULA=Y apt-get install -y --allow-unauthenticated msodbcsql17 mssql-tools

# Avoid sqlcmd termination due to locale -- see https://github.com/Microsoft/mssql-docker/issues/163
RUN echo "nb_NO.UTF-8 UTF-8" > /etc/locale.gen
Expand Down
10 changes: 6 additions & 4 deletions .docker/qgis_resources/test_runner/qgis_testrunner.py
Expand Up @@ -70,7 +70,7 @@ def __get_test_function(test_module_name):
test_module = importlib.import_module(test_module_name)
function_name = 'run_all'
except ImportError as e:
#traceback.print_exc(file=sys.stdout)
# traceback.print_exc(file=sys.stdout)
# Strip latest name
pos = test_module_name.rfind('.')
if pos <= 0:
Expand All @@ -81,7 +81,7 @@ def __get_test_function(test_module_name):
try:
test_module = importlib.import_module(test_module_name)
except ImportError as e:
#traceback.print_exc(file=sys.stdout)
# traceback.print_exc(file=sys.stdout)
raise e
return getattr(test_module, function_name, None)

Expand All @@ -107,7 +107,7 @@ def __get_test_function(test_module_name):
'--noversioncheck',
'--code',
me,
test_module_name, # Must be the last one!
test_module_name, # Must be the last one!
]
command_line = ' '.join(args)
print("QGIS Test Runner - launching QGIS as %s ..." % command_line)
Expand All @@ -129,7 +129,7 @@ def __get_test_function(test_module_name):
print("QGIS Test Runner - %s bytes returned and finished with exit code: %s" % (len(out), 0 if ok else 1))
sys.exit(0 if ok else 1)

else: # We are inside QGIS!
else: # We are inside QGIS!
# Start as soon as the initializationCompleted signal is fired
from qgis.core import QgsApplication, QgsProjectBadLayerHandler, QgsProject
from qgis.PyQt.QtCore import QDir
Expand All @@ -144,6 +144,7 @@ def handleBadLayers(self, layers, dom):

def _write(self, m):
sys.__stdout__.write(m)

writeOut.write = _write

# Add current working dir to the python path
Expand All @@ -167,4 +168,5 @@ def __run_test():
traceback.print_exc(file=sys.stdout)
app = QgsApplication.instance()
os.kill(app.applicationPid(), signal.SIGTERM)

iface.initializationCompleted.connect(__run_test)
11 changes: 10 additions & 1 deletion .docker/qgis_resources/test_runner/qgis_testrunner.sh
Expand Up @@ -13,10 +13,19 @@ TEST_NAME=$1
TEST_RUNNER_PATH=${TEST_RUNNER_PATH:-/usr/bin/qgis_testrunner.py}
QGIS_BUILD_PATH=${QGIS_BUILD_PATH:-qgis}

LOGFILE=/tmp/qgis_testrunner_$$

echo "Running test $1 ..."
OUTPUT=$(QGIS_TEST_MODULE=${TEST_NAME} unbuffer ${QGIS_BUILD_PATH} --version-migration --nologo --code ${TEST_RUNNER_PATH} "$TEST_NAME" 2>/dev/null | tee /dev/tty)
QGIS_TEST_MODULE=${TEST_NAME} unbuffer ${QGIS_BUILD_PATH} \
--version-migration --nologo --code \
${TEST_RUNNER_PATH} "$TEST_NAME" \
2>/dev/null | \
tee ${LOGFILE}

# NOTE: EXIT_CODE will always be 0 if "tee" works,
# we could `set -o pipefail` to change this
EXIT_CODE="$?"
OUTPUT=$(cat $LOGFILE) # quick hack to avoid changing too many lines
if [ -z "$OUTPUT" ]; then
echo "ERROR: no output from the test runner! (exit code: ${EXIT_CODE})"
exit 1
Expand Down
17 changes: 17 additions & 0 deletions .flake8
@@ -0,0 +1,17 @@
[flake8]
ignore =
E501, E402, N802, N806, F401, N803, F841, N801, N805, N815, N816, F811, N814, N804, W503, N807, N813, W504, E741,
# E722: Do not use bare excepts -- A candidate to remove from this list!
E722


exclude =
# There is simply too much in here, somebody will need to check these manually
src/plugins/grass/scripts,
# Generated code, hacking allowed. Feel free to go over it
python/core/auto_additions/,
python/analysis/auto_additions/,
python/gui/auto_additions/,
python/server/auto_additions/,
# Plenty of star imports used
python/PyQt/
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Expand Up @@ -9,11 +9,11 @@ Proper formatting
Before making a pull request, please make sure your code is properly formatted
by running the prepare commit script **before** issuing `git commit`.

./scripts/prepare-commit.sh
./scripts/prepare_commit.sh

This can be automated by setting up the pre-commit hook properly.

ln -s ../../scripts/prepare-commit.sh .git/hooks/pre-commit
ln -s ../../scripts/prepare_commit.sh .git/hooks/pre-commit

Getting your pull request merged
--------------------------------
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -27,8 +27,8 @@
- New unit tests have been added for relevant changes
- You have run the `scripts/prepare-commit.sh` script (https://github.com/qgis/QGIS/blob/master/.github/CONTRIBUTING.md#contributing-to-qgis) before each commit.
If you didn't do this, you can also run `./scripts/astyle-all.sh` from your source folder.
- You have run the `scripts/prepare_commit.sh` script (https://github.com/qgis/QGIS/blob/master/.github/CONTRIBUTING.md#contributing-to-qgis) before each commit.
If you didn't do this, you can also run `./scripts/astyle_all.sh` from your source folder.
- You have read the QGIS Coding Standards (https://docs.qgis.org/testing/en/docs/developers_guide/codingstandards.html) and this PR complies with them
-->

0 comments on commit 85d0956

Please sign in to comment.