Skip to content

Commit

Permalink
Started adding basic automated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Dec 11, 2023
1 parent 4e1cbff commit 7371f18
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
strategy:
matrix:
include:
- name: Windows
os: windows-latest
- name: MacOS
os: macos-latest
- name: Linux
os: ubuntu-20.04

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_full.txt
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest test --cov=gcft_ui --cov=gclib --cov-report=html
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: gcft-htmlcov-${{ matrix.os }}
path: htmlcov
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ settings.txt
/.venv
profileresults*.txt
profileresults*.prof
.coverage
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@
"search.exclude": {
"PyJ3DUltra": true,
},
"python.analysis.exclude": [
"PyJ3DUltra"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"test",
"--cov=gcft_ui",
"--cov=gclib",
"--cov-report=html",
],
}
8 changes: 1 addition & 7 deletions gcft.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#!/usr/bin/python3

import sys
import traceback
from PySide6.QtGui import *
from PySide6.QtCore import *
from PySide6.QtWidgets import *

import sys

sys.path.insert(0, "./gclib")
sys.path.insert(0, "./PyJ3DUltra/build")
sys.path.insert(0, "./PyJ3DUltra/build/Release")
sys.path.insert(0, "./PyJ3DUltra/build/Debug")

from gcft_ui.main_window import GCFTWindow

def signal_handler(sig, frame):
Expand Down
6 changes: 6 additions & 0 deletions gcft_ui/main_window.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import sys
import os
import re
import traceback
Expand All @@ -8,6 +9,11 @@
from PySide6.QtCore import *
from PySide6.QtWidgets import *

sys.path.insert(0, "./gclib")
sys.path.insert(0, "./PyJ3DUltra/build")
sys.path.insert(0, "./PyJ3DUltra/build/Release")
sys.path.insert(0, "./PyJ3DUltra/build/Debug")

from gclib import fs_helpers as fs
from gcft_ui.uic.ui_main import Ui_MainWindow
from gcft_ui.gcft_common import GCFTThread, GCFTProgressDialog
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths =
test
3 changes: 3 additions & 0 deletions requirements_full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ numpy~=1.26.0
PyOpenGL>=3.1.0,<3.1.7
pyrr==0.10.3
PyInstaller~=6.2.0
pytest~=7.4.0
pytest-cov~=4.1.0
pytest-qt~=4.2.0
4 changes: 4 additions & 0 deletions test/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

def test_gui_launches(qtbot):
from gcft_ui.main_window import GCFTWindow
window = GCFTWindow()

0 comments on commit 7371f18

Please sign in to comment.