Commit c7c95a79 authored by Simon Feltman's avatar Simon Feltman Committed by Martin Pitt
Browse files

Clean up sys.path handling in tests

Only set sys.path once in runtests.py, not in the individual test modules. This
reduces hidden dependencies between tests by building up a run order dependent
search path, and also makes it easier in the future to run the tests against
the installed system libraries.

Side issue in https://bugzilla.gnome.org/show_bug.cgi?id=680913
parent 3e3525e9
......@@ -7,8 +7,12 @@ import sys
import glob
import unittest
mydir = os.path.dirname(os.path.abspath(__file__))
# The ordering of sys.path should be ['.../pyobject', '.../pygobject/tests']
sys.path.insert(0, mydir)
sys.path.insert(0, os.path.dirname(mydir))
os.environ['PYGTK_USE_GIL_STATE_API'] = ''
sys.path.insert(0, os.path.dirname(__file__))
sys.argv.append('--g-fatal-warnings')
from gi.repository import GObject
......
......@@ -12,6 +12,9 @@ if '--help' in sys.argv:
sys.exit(0)
mydir = os.path.dirname(os.path.abspath(__file__))
# The ordering of sys.path should be ['.../pyobject', '.../pygobject/tests']
sys.path.insert(0, mydir)
sys.path.insert(0, os.path.dirname(mydir))
# force untranslated messages, as we check for them in some tests
os.environ['LC_MESSAGES'] = 'C'
......
......@@ -5,7 +5,6 @@
import unittest
import sys
sys.path.insert(0, "../")
from sys import getrefcount
import copy
......
......@@ -3,9 +3,6 @@
import unittest
import sys
sys.path.insert(0, "../")
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
......
......@@ -3,9 +3,6 @@
import unittest
import sys
sys.path.insert(0, "../")
from compathelper import _long, _unicode, _bytes
import gi.overrides as overrides
......
......@@ -3,9 +3,6 @@
import unittest
import sys
sys.path.insert(0, "../")
from gi.repository import GLib
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment