Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making tests work in different environment #245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Plugin test suite

To run the tests, use
```
export PYTHONPATH="/usr/share/qgis/python/plugins/"
python3 run_test.py
```
Binary file added tests/expected/scene1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/expected/scene1_qwebpage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test03_check_scene1_webpage(self):

filename = "scene1_qwebpage.png"
image.save(outputPath(filename))

assert QImage(outputPath(filename)) == QImage(expectedDataPath(filename)), "captured image is different from expected."

def test11_export_scene1_image(self):
Expand Down
11 changes: 5 additions & 6 deletions tests/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@ def pluginPath(subdir=None):


def dataPath(subdir=None):
data_path = "E:/qgis2threejs_test_dev/data" # [work in progress]
#data_path = pluginPath(os.path.join("tests", "data"))
data_path = os.path.join(os.path.dirname(__file__), "data")
if subdir is None:
return data_path
return os.path.join(data_path, subdir)


def expectedDataPath(subdir=None):
data_path = "E:/qgis2threejs_test_dev/expected" # [work in progress]
#data_path = pluginPath(os.path.join("tests", "expected"))
data_path = os.path.join(os.path.dirname(__file__), "expected")
if not os.path.isdir(data_path):
os.mkdir(data_path)
if subdir is None:
return data_path
return os.path.join(data_path, subdir)


def outputPath(subdir=None):
data_path = "E:/qgis2threejs_test_dev/output" # [work in progress]
#data_path = pluginPath(os.path.join("tests", "output"))
data_path = os.path.join(os.path.dirname(__file__), "output")
if subdir is None:
return data_path
return os.path.join(data_path, subdir)
Expand Down