summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-04-11 15:14:36 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-04-11 15:14:36 +0000
commitc10ecb8121f62361f744fd3d6034c9339890f6f8 (patch)
tree77cae05805368e46a7a4b34dff8df104c4d630cb /tests
parentdd6f0893eaea89726576fc960257334d00d4544e (diff)
downloadpygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.tar.gz
pygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.tar.xz
pygobject-c10ecb8121f62361f744fd3d6034c9339890f6f8.zip
Turn gobject into a package; move _gobject to gobject._gobject and
add gobject/__init__.py. Update macros and testsuite.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/common.py19
2 files changed, 12 insertions, 15 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 39ba16d..8ccb3c3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,6 +37,12 @@ tests = \
testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
$(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS)
-check-local:
+check-local: $(top_srcdir)/gobject/__init__.py
+ @if test "$(top_builddir)" != "$(top_srcdir)"; then \
+ cp $(top_srcdir)/gobject/__init__.py $(top_builddir)/gobject/__init__.py; \
+ fi
@$(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir)
+ @if test "$(top_builddir)" != "$(top_srcdir)"; then \
+ rm -f $(top_builddir)/gobject/__init__.py*; \
+ fi
@rm -fr *.pyc
diff --git a/tests/common.py b/tests/common.py
index 3cd6386..ef040af 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -7,16 +7,15 @@ def importModules(buildDir, srcDir):
# ltihooks
sys.path.insert(0, srcDir)
+ sys.path.insert(0, buildDir)
+ sys.path.insert(0, os.path.join(buildDir, 'gobject'))
import ltihooks
- sys.path.remove(srcDir)
- # gobject
- sys.path.insert(0, os.path.join(buildDir, 'gobject'))
# testhelper
sys.path.insert(0, os.path.join(buildDir, 'tests'))
sys.argv.append('--g-fatal-warnings')
- gobject = importModule('gobject', buildDir, 'gobject/gobject.la')
+ gobject = importModule('gobject', buildDir, 'gobject')
testhelper = importModule('testhelper', '.')
ltihooks.uninstall()
@@ -31,20 +30,13 @@ def importModule(module, directory, name=None):
global isDistCheck
origName = module
- if '.' in module:
- fromlist = '.'.join(module.split('.')[:-1])
- else:
- fromlist = None
-
if not name:
name = module + '.la'
try:
- obj = __import__(module, {}, {}, fromlist)
+ obj = __import__(module, {}, {}, '')
except ImportError, e:
- print 'WARNING: %s could not be imported' % origName
- print e
- return
+ raise SystemExit('%s could not be imported' % origName)
if hasattr(obj, '__file__'):
location = obj.__file__
@@ -58,5 +50,4 @@ def importModule(module, directory, name=None):
if current != expected:
raise AssertionError('module %s imported from wrong location. Expected %s, got %s' % (
module, expected, current))
-
return obj