Skip to content

Commit

Permalink
Fix tox testing issues when running with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
MHendricks committed Jul 29, 2023
1 parent 2e4573f commit 594739a
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/static-analysis-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Format with black
run: tox -e black

- name: Py 2 and 3 compatibility
run: tox -e modernize


test:
strategy:
Expand Down
22 changes: 2 additions & 20 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
graft blurdev/lang
graft blurdev/resource
graft blurdev/runtimes
graft blurdev/traxoffline/trax/api/data/source

recursive-include blurdev/ide/wizards/environmentwizard/templ *.blurproj
recursive-include blurdev/ide/wizards/toolwizard/templ *.blurproj
recursive-include blurdev/traxoffline/trax/gui/dialogs/infodialog/ui *.ui

recursive-include blurdev/gui *.ui
recursive-include blurdev/gui *.png
recursive-include blurdev/gui *.yaml

recursive-include blurdev/ide *.png
recursive-include blurdev/ide *.ui
recursive-include blurdev/ide *.ini
recursive-include blurdev/ide *.xml
recursive-include blurdev/ide *.txt
recursive-include blurdev/ide *.pytempl

graft preditor/resource
graft preditor/dccs
recursive-include preditor *.ui
2 changes: 2 additions & 0 deletions preditor/about_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

import abc
import os
import sys
Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/drag_tab_bar.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from Qt.QtCore import QByteArray, QMimeData, QPoint, QRect, Qt
from Qt.QtGui import QCursor, QDrag, QPixmap, QRegion
from Qt.QtWidgets import QInputDialog, QMenu, QTabBar
Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/editor_chooser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from Qt.QtCore import Slot
from Qt.QtGui import QIcon
from Qt.QtWidgets import QWidget
Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/group_tab_widget/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

import os
import re

Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/group_tab_widget/grouped_tab_menu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from preditor.gui.level_buttons import LazyMenu


Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/group_tab_widget/grouped_tab_widget.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from Qt.QtCore import Qt
from Qt.QtGui import QIcon
from Qt.QtWidgets import QMessageBox, QToolButton
Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/group_tab_widget/one_tab_widget.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

from Qt.QtWidgets import QTabWidget


Expand Down
2 changes: 1 addition & 1 deletion preditor/gui/workbox_mixin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import
from __future__ import absolute_import, print_function

import os
import tempfile
Expand Down
2 changes: 2 additions & 0 deletions preditor/gui/workbox_text_edit.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

import logging

from Qt.QtCore import Qt
Expand Down
2 changes: 2 additions & 0 deletions preditor/logging_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import absolute_import

import json
import logging
import logging.config
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
configparser>=4.0.2
future>=0.18.2
importlib-metadata>=4.8.3;python_version>="3.6"
python-redmine>=2.1.1
Qt.py
signalslot>=0.1.2
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ install_requires =
future>=0.18.2
python-redmine>=2.1.1
signalslot>=0.1.2
importlib-metadata>=5.0.0;python_version>="3.6"
importlib-metadata>=4.8.3;python_version>="3.6"
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
include_package_data = True
setup_requires =
Expand Down
16 changes: 13 additions & 3 deletions tests/ide/test_delayable_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import sys

import pytest
from Qt.QtWidgets import QApplication

from preditor.delayable_engine import DelayableEngine
from preditor.scintilla.delayables import Delayable, RangeDelayable
from preditor.delayable_engine.delayables import Delayable, RangeDelayable
from preditor.scintilla.documenteditor import DocumentEditor

# TODO: Re-enable these tests once they work on the gitlab runners
# TODO: Re-enable these tests once they work on the github runners
pytestmark = pytest.mark.skipif(
sys.platform != "win32", reason="Test fails on gitrunner"
)
Expand Down Expand Up @@ -48,11 +49,20 @@ def remove_document(self, document):
@pytest.fixture()
def engine():
"""Creates a test DelayableEngine and DocumentEditor.
The DocumentEditor can be accessd by using `engine.test_doc`.
The DocumentEditor can be accessed by using `engine.test_doc`.
"""
global app
if not QApplication.instance():
# These test require an initialized QApplication create one and ensure
# it doesn't get garbage collected. Creating the app here prevents
# segfaults when skipping this file on linux. We need to figure out
# how to run these tests in github actions.
app = QApplication([])

engine = DelayableEngine('test_engine')
engine.test_doc = DocumentEditor(None)
engine.add_document(engine.test_doc)

return engine


Expand Down
20 changes: 12 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = begin,py{27,36,37,38,39},black,flake8
envlist = begin,py{27,36,37,38,39},modernize,black,flake8
skip_missing_interpreters = True
skipsdist = True

Expand All @@ -15,24 +15,28 @@ deps =
-rrequirements.txt
covdefaults
coverage
modernize
pytest
PyQt5;python_version>="3.5"
QScintilla>=2.11.4;python_version>="3.5"
Qt.py
QtSiteConfigBlur
commands =
# Ensure the version.py file is created
python setup.py egg_info

python -m coverage run -m pytest {posargs:tests/}
python -m coverage report

[testenv:modernize]
# Test compatibility with python 2 and 3
deps =
modernize
commands =
# Check for python 3 compliance
python -m compileall -f -q -x \.tox|shared-venv .
# Note: `-f numliterals -f except -f dict_six` always report failure so we can't include them
# in this test.
python -m modernize -f print -f import -f basestring -f unicode_type --enforce ./preditor

# Ensure the version.py file is created
python setup.py egg_info

python -m coverage run -m pytest {posargs:tests/}
python -m coverage report

[testenv:begin]
basepython = python3
Expand Down

0 comments on commit 594739a

Please sign in to comment.