Adding pytest to drone ci
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adsooi 2024-09-18 18:01:51 +02:00
parent 4759bdcd33
commit 29e48e284c
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 13 additions and 24 deletions

View file

@ -11,35 +11,19 @@ steps:
commands:
- git submodule update --init --recursive
- name: Linux test
image: ad5001/ubuntu-pyside6-xvfb:jammy-6.6.1
- name: Tests
image: ad5001/ubuntu-pyside6-xvfb:noble-6.7.2
commands:
- pytest --cov --cov-report term-missing
- xvfb-run python3 run.py --test-build --no-check-for-updates
- xvfb-run python3 run.py --test-build --no-check-for-updates ./ci/test1.lpf
- xvfb-run python3 run.py --test-build --no-check-for-updates ./ci/test2.lpf
when:
event: [ push, tag ]
# - name: Windows test
# image: ad5001/ubuntu-pyside6-xvfb-wine:win7-6.5.0-rev1
# commands:
# - # For some reason, launching GUI apps with wine, even with xvfb-run, fails.
# - xvfb-run python run.py --test-build --no-check-for-updates
# - xvfb-run python run.py --test-build --no-check-for-updates ./ci/test1.lpf
# - xvfb-run python run.py --test-build --no-check-for-updates ./ci/test2.lpf
# when:
# event: [ push, tag ]
# - name: Linux packaging
# image: ad5001/ubuntu-pyside6-xvfb:jammy-6.5.0
# commands:
# - bash scripts/package-linux.sh
# when:
# event: [ push, tag ]
- name: Windows building
image: ad5001/ubuntu-pyside6-xvfb-wine:win10-6.6.1
- name: Windows build
image: ad5001/ubuntu-pyside6-xvfb-wine:win10-6.7.2
commands:
- bash scripts/build-wine.sh
- bash scripts/package-wine.sh

View file

@ -1,13 +1,16 @@
import pytest
from os import getcwd
from os.path import join
from tempfile import TemporaryDirectory
from LogarithmPlotter.util import config
pwd = getcwd()
@pytest.fixture()
def resource():
def temporary():
directory = TemporaryDirectory()
config.CONFIG_PATH = join(directory.name, "config.json")
tmpfile = join(directory.name, 'graph.png')
tmpfile = join(directory.name, "graph.png")
yield tmpfile
directory.cleanup()

View file

@ -13,6 +13,7 @@ class TestPyJS:
def test_set(self):
obj.num1 = 2
obj.num2 = QJSValue(2)
obj.num3 = PyJSValue(QJSValue(2))
with pytest.raises(InvalidAttributeValueException):
obj.num3 = object()
@ -20,6 +21,7 @@ class TestPyJS:
obj.num = QJSValue(2)
assert obj.num == 2
assert obj.num == QJSValue(2)
assert obj.num == PyJSValue(QJSValue(2))
assert obj.num != object()
def test_function(self):