From 38a7a50d1cacd927a4eaf783b142eec32888c7a1 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Wed, 22 Mar 2017 19:36:45 -0700 Subject: [PATCH] move helpers functions out (cherry picked from commit 2047d3f) --- _development/__init__.py | 0 .../test_smoketests => _development}/helpers.py | 2 +- tests/test_modules/gui/test_aboutData.py | 10 +++++++++- tests/test_modules/service/test_attribute.py | 9 +++++++++ tests/test_smoketests/test_rifter.py | 15 ++------------- 5 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 _development/__init__.py rename {tests/test_smoketests => _development}/helpers.py (96%) diff --git a/_development/__init__.py b/_development/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_smoketests/helpers.py b/_development/helpers.py similarity index 96% rename from tests/test_smoketests/helpers.py rename to _development/helpers.py index 803d3d7e4..57adf04c3 100644 --- a/tests/test_smoketests/helpers.py +++ b/_development/helpers.py @@ -20,7 +20,7 @@ def DBInMemory(): gamedataCache = True saveddataCache = True gamedata_version = "" - eos.config.gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(unicode(__file__))), "..", "..", "eve.db")) + eos.config.gamedata_connectionstring = 'sqlite:///' + realpath(join(dirname(abspath(unicode(__file__))), "..", "eve.db")) # saveddata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding()) eos.config.saveddata_connectionstring = 'sqlite:///:memory:' diff --git a/tests/test_modules/gui/test_aboutData.py b/tests/test_modules/gui/test_aboutData.py index d1a067e71..e54901201 100644 --- a/tests/test_modules/gui/test_aboutData.py +++ b/tests/test_modules/gui/test_aboutData.py @@ -1,5 +1,13 @@ -from gui.aboutData import versionString, licenses, developers, credits, description +import os +import sys +''' +script_dir = os.path.dirname(os.path.abspath(__file__)) +# Add root folder to python paths +sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..'))) +''' + +from gui.aboutData import versionString, licenses, developers, credits, description def test_aboutData(): """ diff --git a/tests/test_modules/service/test_attribute.py b/tests/test_modules/service/test_attribute.py index 1ab44f2a8..25eedc51a 100644 --- a/tests/test_modules/service/test_attribute.py +++ b/tests/test_modules/service/test_attribute.py @@ -1,3 +1,12 @@ +import os +import sys + +''' +script_dir = os.path.dirname(os.path.abspath(__file__)) +# Add root folder to python paths +sys.path.append(os.path.realpath(os.path.join(script_dir, '..', '..'))) +''' + from service.attribute import Attribute diff --git a/tests/test_smoketests/test_rifter.py b/tests/test_smoketests/test_rifter.py index 408078369..339d00e3a 100644 --- a/tests/test_smoketests/test_rifter.py +++ b/tests/test_smoketests/test_rifter.py @@ -1,19 +1,8 @@ # noinspection PyPackageRequirements + import pytest -import os -import sys - -script_dir = os.path.dirname(os.path.abspath(__file__)) -# Add this folder to paths so we can import our helpers -sys.path.append(os.path.realpath(os.path.join(script_dir))) - -# noinspection PyUnresolvedReferences -from helpers import DBInMemory as DB -# noinspection PyUnresolvedReferences -from helpers import Gamedata -# noinspection PyUnresolvedReferences -from helpers import Saveddata +from _development.helpers import DBInMemory as DB, Gamedata, Saveddata # noinspection PyShadowingNames