Skip to content

Commit

Permalink
Don't import HTInstallation in editor tests until PyQt5 check passes
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Nov 12, 2023
1 parent 3fd615d commit 094b59e
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 35 deletions.
8 changes: 6 additions & 2 deletions tests/gui/editors/test_are_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
import unittest
from unittest import TestCase

from PyQt5.QtWidgets import QApplication
try:
from PyQt5.QtTest import QTest
from PyQt5.QtWidgets import QApplication
except (ImportError, ModuleNotFoundError):
QTest, QApplication = None, None

if getattr(sys, "frozen", False) is False:
pykotor_path = pathlib.Path(__file__).parents[3] / "pykotor"
toolset_path = pathlib.Path(__file__).parents[3] / "toolset"
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.are import AREEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -30,6 +33,7 @@ class AREEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_bwm_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.bwm import BWMEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class BWMEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/gui/editors/test_dlg_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation

K1_PATH = os.environ.get("K1_PATH")


Expand All @@ -33,6 +31,7 @@ class DLGEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None) # type: ignore[reportGeneralTypeIssues]

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_erf_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.erf import ERFEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class ERFEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_gff_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.gff import GFFEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class GFFEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/gui/editors/test_git_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))


from toolset.data.installation import HTInstallation
from toolset.gui.editors.git import GITEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -35,6 +33,7 @@ class GITEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_jrl_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.jrl import JRLEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class JRLEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_nss_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.nss import NSSEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class NSSEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_ssf_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.ssf import SSFEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class SSFEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_tlk_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.tlk import TLKEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class TLKEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_tpc_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.tpc import TPCEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class TPCEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_twoda_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.twoda import TwoDAEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class TwoDAEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/gui/editors/test_txt_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
try:
from PyQt5.QtTest import QTest
from PyQt5.QtWidgets import QApplication
from toolset.data.installation import HTInstallation
except (ImportError, ModuleNotFoundError):
QTest, QApplication = None, None

Expand All @@ -16,9 +17,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.txt import TXTEditor

K1_PATH = os.environ.get("K1_PATH")


Expand All @@ -34,9 +32,11 @@ class TXTEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
from toolset.gui.editors.txt import TXTEditor
self.app = QApplication([])
self.ui = TXTEditor(None, self.INSTALLATION)

Expand Down
5 changes: 2 additions & 3 deletions tests/gui/editors/test_utc_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.utc import UTCEditor

K1_PATH = os.environ.get("K1_PATH")


Expand All @@ -34,9 +31,11 @@ class UTCEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
from toolset.gui.editors.utc import UTCEditor
self.app = QApplication([])
self.ui = UTCEditor(None, self.INSTALLATION)

Expand Down
4 changes: 2 additions & 2 deletions tests/gui/editors/test_utd_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.utd import UTDEditor

K1_PATH = os.environ.get("K1_PATH")

Expand All @@ -33,10 +31,12 @@
class UTDEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
from toolset.data.installation import HTInstallation
# Make sure to configure this environment path before testing!
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
from toolset.gui.editors.utd import UTDEditor
self.app = QApplication([])
self.ui = UTDEditor(None, self.INSTALLATION)

Expand Down
5 changes: 2 additions & 3 deletions tests/gui/editors/test_ute_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.ute import UTEEditor

K1_PATH = os.environ.get("K1_PATH")


Expand All @@ -34,9 +31,11 @@ class UTEEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
from toolset.gui.editors.ute import UTEEditor
self.app = QApplication([])
self.ui = UTEEditor(None, self.INSTALLATION)

Expand Down
4 changes: 2 additions & 2 deletions tests/gui/editors/test_uti_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.uti import UTIEditor

K1_PATH = os.environ.get("K1_PATH")

Expand All @@ -34,9 +32,11 @@ class UTIEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
from toolset.gui.editors.uti import UTIEditor
self.app = QApplication([])
self.ui = UTIEditor(None, self.INSTALLATION)

Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_utm_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.utm import UTMEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -33,6 +32,7 @@
class UTMEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
from toolset.data.installation import HTInstallation
# Make sure to configure this environment path before testing!
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

Expand Down
2 changes: 1 addition & 1 deletion tests/gui/editors/test_utp_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation
from toolset.gui.editors.utp import UTPEditor

K1_PATH = os.environ.get("K1_PATH")
Expand All @@ -34,6 +33,7 @@ class UTPEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions tests/gui/editors/test_uts_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
if pykotor_path.exists() or toolset_path.exists():
sys.path.insert(0, str(pykotor_path.parent))

from toolset.data.installation import HTInstallation

K1_PATH = os.environ.get("K1_PATH")


Expand All @@ -33,6 +31,7 @@ class UTSEditorTest(TestCase):
@classmethod
def setUpClass(cls) -> None:
# Make sure to configure this environment path before testing!
from toolset.data.installation import HTInstallation
cls.INSTALLATION = HTInstallation(K1_PATH, "", False, None)

def setUp(self) -> None:
Expand Down
Loading

0 comments on commit 094b59e

Please sign in to comment.