Skip to content

Commit 17ced6d

Browse files
committed
use unitest assert and os.path.join as adviced
1 parent ee79804 commit 17ced6d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/src/python/test_qgsserver_two_layers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TestQgsServerTwoLayer(unittest.TestCase):
2828

2929
def setUp(self):
3030
"""Create the server instance"""
31-
self.testdata_path = unitTestDataPath('qgis_server') + '/'
31+
self.testdata_path = unitTestDataPath('qgis_server')
3232

3333
env_vars = ['QUERY_STRING', 'QGIS_PROJECT_FILE']
3434
for ev in env_vars:
@@ -49,7 +49,7 @@ def assert_headers(self, header, body):
4949
def result_compare(self, file_name, error_msg_header, header, body):
5050
self.assert_headers(header, body)
5151
response = header + body
52-
f = open(self.testdata_path + file_name)
52+
f = open(os.path.join(self.testdata_path, file_name))
5353
expected = f.read()
5454
f.close()
5555
# Store the output for debug or to regenerate the reference documents:
@@ -69,8 +69,8 @@ def result_compare(self, file_name, error_msg_header, header, body):
6969
unicode(response, errors='replace')))
7070

7171
def wfs_getfeature_post_compare(self, requestid, request):
72-
project = self.testdata_path + "test_project_two_layers.qgs"
73-
assert os.path.exists(project), "Project file not found: " + project
72+
project = os.path.join (self.testdata_path, "test_project_two_layers.qgs")
73+
self.assertTrue(os.path.exists(project), msg=u"Project file not found: %s" % (project))
7474

7575
query_string = 'MAP={}'.format(urllib.quote(project))
7676
self.server.putenv("REQUEST_METHOD", "POST")

0 commit comments

Comments
 (0)