This commit is contained in:
KatKatKateryna 2024-01-19 23:55:32 +00:00
Родитель 61820869e2
Коммит 51308e2ccd
6 изменённых файлов: 61 добавлений и 2 удалений

Просмотреть файл

@ -8,7 +8,14 @@ from specklepy.objects.other import RevitParameter
# [tool.pytest.ini_options]
# pythonpath = "speckle"
# pytest -o console_output_style=classic
# poetry self add poetry-dotenv-plugin
# https://pypi.org/project/poetry-dotenv-plugin/
# USE_PATH_FOR_GDAL_PYTHON=YES
# from OSGeo4W shell:
# "C:\Program Files\QGIS 3.34.1\bin\python-qgis.bat" -m pip install pytest
# "C:\Program Files\QGIS 3.34.1\bin\python-qgis.bat" C:\Users\katri\AppData\Roaming\QGIS\QGIS3\profiles\development\python\plugins\speckle-qgis\tests\unit\geometry_tests\conftest.py
def someF(path):
import importlib.util

Просмотреть файл

@ -8,7 +8,7 @@ from speckle.utils.panel_logging import logToUser
from specklepy.objects import Base
def addFeatVariant(key, variant, value, f: "QgsFeature"):
def addFeatVariant(key, variant, value, f: "QgsFeature") -> "QgsFeature":
try:
feat = f
if variant == 10:

Просмотреть файл

@ -0,0 +1,4 @@
import sys
sys.path.append(r"C:\OSGeo4W\apps\qgis\python")
sys.path.insert(0,r"C:\Users\katri\AppData\Roaming\Speckle\connector_installations\QGIS")

Просмотреть файл

@ -0,0 +1,28 @@
import math
from typing import Union
import pytest
from specklepy_qt_ui.qt_ui.DataStorage import DataStorage
from specklepy.objects.encoding import CurveTypeEncoding
from specklepy.objects.geometry import Arc, Line, Mesh, Point, Plane, Polycurve, Vector
from qgis._core import (
QgsCoordinateTransform,
Qgis,
QgsPointXY,
QgsGeometry,
QgsRasterBandStats,
QgsFeature,
QgsFields,
QgsField,
QgsVectorLayer,
QgsRasterLayer,
QgsCoordinateReferenceSystem,
QgsProject,
QgsUnitTypes,
)
@pytest.fixture()
def qgis_feature():
sample_obj = QgsFeature()
return sample_obj

Просмотреть файл

@ -3,3 +3,24 @@ from speckle.converter.features.utils import (
updateFeat,
getPolygonFeatureHeight,
)
from qgis._core import (
QgsCoordinateTransform,
Qgis,
QgsPointXY,
QgsGeometry,
QgsRasterBandStats,
QgsFeature,
QgsFields,
QgsField,
QgsVectorLayer,
QgsRasterLayer,
QgsCoordinateReferenceSystem,
QgsProject,
QgsUnitTypes,
)
def test_addFeatVariant(qgis_feature):
key = "some key"
variant = 10 # string
value = "value to add"
result = addFeatVariant(key, variant, value, qgis_feature)
assert isinstance(result, QgsFeature)

Просмотреть файл

@ -1,7 +1,6 @@
import math
from typing import Union
import pytest
from specklepy_qt_ui.qt_ui.DataStorage import DataStorage
from specklepy.objects.encoding import CurveTypeEncoding