Skip to content

Commit

Permalink
tests: added missing commands in conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jan 6, 2022
1 parent 28d9558 commit 7b42d76
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,3 +1,5 @@
0.12.1
- build: fixed testing pipeline
0.12.0
- feat: support loading nanite model files as extensions
- feat: added automatic update check during startup
Expand Down
19 changes: 19 additions & 0 deletions tests/conftest.py
Expand Up @@ -2,6 +2,8 @@
import tempfile
import time

from PyQt5 import QtCore

TMPDIR = tempfile.mkdtemp(prefix=time.strftime(
"pyjibe_test_%H.%M_"))

Expand All @@ -12,11 +14,28 @@ def pytest_configure(config):
This hook is called for every plugin and initial conftest
file after command line options have been parsed.
"""
# disable update checking
QtCore.QCoreApplication.setOrganizationName("AFM-Analysis")
QtCore.QCoreApplication.setOrganizationDomain("pyjibe.mpl.mpg.de")
QtCore.QCoreApplication.setApplicationName("PyJibe")
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)
settings = QtCore.QSettings()
settings.setIniCodec("utf-8")
settings.setValue("check for updates", 0)
settings.sync()
# set global temp directory
tempfile.tempdir = TMPDIR


def pytest_unconfigure(config):
"""
called before test process is exited.
"""
QtCore.QCoreApplication.setOrganizationName("AFM-Analysis")
QtCore.QCoreApplication.setOrganizationDomain("pyjibe.mpl.mpg.de")
QtCore.QCoreApplication.setApplicationName("PyJibe")
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)
settings = QtCore.QSettings()
settings.setIniCodec("utf-8")
# clear global temp directory
shutil.rmtree(TMPDIR, ignore_errors=True)
3 changes: 2 additions & 1 deletion tests/test_head_update.py
@@ -1,3 +1,4 @@
import encodings.idna # noqa: F401
import os
import socket

Expand All @@ -21,7 +22,7 @@
@pytest.mark.skipif(not NET_AVAILABLE, reason="No network connection!")
def test_update_basic():
mdict = update.check_release(ghrepo="AFM-analysis/PyJibe",
version="0.11.0")
version="0.1.0")
assert mdict["errors"] is None
assert mdict["update available"]
mdict = update.check_release(ghrepo="AFM-analysis/PyJibe",
Expand Down

0 comments on commit 7b42d76

Please sign in to comment.