Created
March 18, 2020 08:21
-
-
Save Gustry/cb8e67581bf66500254a5df5fa9e8f60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from qgis.core import QgsVectorLayer, QgsProject | |
from qgis.testing import unittest, start_app | |
start_app() | |
class TestTest(unittest.TestCase): | |
def test_passes(self): | |
layer = QgsVectorLayer('Point', 'layer', 'memory') | |
self.assertTrue(True) | |
self.assertTrue(layer.isValid()) | |
QgsProject.instance().addMapLayer(layer) | |
self.assertFalse(False) | |
def run_all(): | |
"""Default function that is called by the runner if nothing else is specified""" | |
suite = unittest.TestSuite() | |
suite.addTests(unittest.makeSuite(TestTest, 'test')) | |
unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(suite) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Launch this file using docker
docker run -d --name qgis -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/etienne/dev/python/test_project/:/tests_directory -e DISPLAY=:99 qgis/qgis:latest
docker exec -it qgis sh -c "cd /tests_directory && qgis_testrunner.sh test_project.run_all"