Skip to content

Commit

Permalink
Fix PyQgsVirtualLayerDefinition test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 31, 2016
1 parent cb14910 commit 9e759ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/src/python/test_qgsvirtuallayerdefinition.py
Expand Up @@ -22,6 +22,7 @@

from qgis.testing import unittest
from PyQt.QtCore import QVariant, QUrl
import os


class TestQgsVirtualLayerDefinition(unittest.TestCase):
Expand All @@ -33,9 +34,9 @@ def test1(self):
self.assertEqual(d.toString(), "file:///file")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(d.toUrl()).filePath(), "/file")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(QUrl.fromEncoded(d.toString())).filePath(), "/file")
d.setFilePath("C:\\file")
self.assertEqual(d.toString(), "file:///C:%5Cfile")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(d.toUrl()).filePath(), "C:\\file")
d.setFilePath(os.path.join('C:/', 'file'))
self.assertEqual(d.toString(), "file:///C:/file")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(d.toUrl()).filePath(), os.path.join('C:/', 'file'))
d.setQuery("SELECT * FROM mytable")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(d.toUrl()).query(), "SELECT * FROM mytable")
self.assertEqual(QgsVirtualLayerDefinition.fromUrl(QUrl.fromEncoded(d.toString())).query(), "SELECT * FROM mytable")
Expand Down

0 comments on commit 9e759ef

Please sign in to comment.