Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 14, 2020
1 parent 2f8201a commit cc67a6f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/src/python/test_qgsprocessexecutable.py
Expand Up @@ -160,7 +160,7 @@ def testAlgorithmRunNoArgs(self):
self.assertIn('inputs', output.lower())
self.assertEqual(rc, 1)

def testAlgorithmRun(self):
def testAlgorithmRunLegacy(self):
output_file = self.TMP_DIR + '/polygon_centroid.shp'
rc, output, err = self.run_process(['run', 'native:centroids', '--INPUT={}'.format(TEST_DATA_DIR + '/polys.shp'), '--OUTPUT={}'.format(output_file)])
if os.environ.get('TRAVIS', '') != 'true':
Expand All @@ -172,9 +172,21 @@ def testAlgorithmRun(self):
self.assertTrue(os.path.exists(output_file))
self.assertEqual(rc, 0)

def testAlgorithmRun(self):
output_file = self.TMP_DIR + '/polygon_centroid.shp'
rc, output, err = self.run_process(['run', 'native:centroids', '--', 'INPUT={}'.format(TEST_DATA_DIR + '/polys.shp'), 'OUTPUT={}'.format(output_file)])
if os.environ.get('TRAVIS', '') != 'true':
# Travis DOES have errors, due to QStandardPaths: XDG_RUNTIME_DIR not set warnings raised by Qt
self.assertFalse(err)
self.assertIn('0...10...20...30...40...50...60...70...80...90', output.lower())
self.assertIn('results', output.lower())
self.assertIn('OUTPUT:\t' + output_file, output)
self.assertTrue(os.path.exists(output_file))
self.assertEqual(rc, 0)

def testAlgorithmRunJson(self):
output_file = self.TMP_DIR + '/polygon_centroid2.shp'
rc, output, err = self.run_process(['run', '--json', 'native:centroids', '--INPUT={}'.format(TEST_DATA_DIR + '/polys.shp'), '--OUTPUT={}'.format(output_file)])
rc, output, err = self.run_process(['run', '--json', 'native:centroids', '--', 'INPUT={}'.format(TEST_DATA_DIR + '/polys.shp'), 'OUTPUT={}'.format(output_file)])
res = json.loads(output)

self.assertIn('gdal_version', res)
Expand All @@ -201,7 +213,7 @@ def testModelHelp(self):

def testModelRun(self):
output_file = self.TMP_DIR + '/model_output.shp'
rc, output, err = self.run_process(['run', TEST_DATA_DIR + '/test_model.model3', '--FEATS={}'.format(TEST_DATA_DIR + '/polys.shp'), '--native:centroids_1:CENTROIDS={}'.format(output_file)])
rc, output, err = self.run_process(['run', TEST_DATA_DIR + '/test_model.model3', '--', 'FEATS={}'.format(TEST_DATA_DIR + '/polys.shp'), 'native:centroids_1:CENTROIDS={}'.format(output_file)])
if os.environ.get('TRAVIS', '') != 'true':
# Travis DOES have errors, due to QStandardPaths: XDG_RUNTIME_DIR not set warnings raised by Qt
self.assertFalse(err)
Expand Down

0 comments on commit cc67a6f

Please sign in to comment.