diff --git a/test/testlib.py b/test/lib/__init__.py
similarity index 84%
rename from test/testlib.py
rename to test/lib/__init__.py
index 3682ba86a0beb4c3b7c775a21d46547d8ccef8d8..3a1300e12f42afc12e7e51d0ae743140b2e5a669 100644
--- a/test/testlib.py
+++ b/test/lib/__init__.py
@@ -1,10 +1,11 @@
 import sys
 import os.path
 
-gajim_root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
+gajim_root = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..')
 
-# look for modules in the CWD, then gajim/src, then everywhere else
+# look for modules in the CWD, then gajim/test/lib, then gajim/src, then everywhere else
 sys.path.insert(1, gajim_root + '/src')
+sys.path.insert(1, gajim_root + '/test/lib')
 
 # a temporary version of ~/.gajim for testing
 configdir = gajim_root + '/test/tmp'
diff --git a/test/data.py b/test/lib/data.py
similarity index 100%
rename from test/data.py
rename to test/lib/data.py
diff --git a/test/mock.py b/test/lib/mock.py
similarity index 100%
rename from test/mock.py
rename to test/lib/mock.py
diff --git a/test/mocks.py b/test/lib/mocks.py
similarity index 100%
rename from test/mocks.py
rename to test/lib/mocks.py
diff --git a/test/notify.py b/test/lib/notify.py
similarity index 100%
rename from test/notify.py
rename to test/lib/notify.py
diff --git a/test/test_caps.py b/test/test_caps.py
index 642da1cb8eeb690d5c1ddda85a9ee7fdc09ad2d2..3a2bddeba322cc16997cec5ea19f4aa7cafd4049 100644
--- a/test/test_caps.py
+++ b/test/test_caps.py
@@ -1,8 +1,8 @@
 # tests for capabilities and the capabilities cache
 import unittest
 
-import testlib
-testlib.setup_env()
+import lib
+lib.setup_env()
 
 from common import gajim
 from common import xmpp
@@ -46,4 +46,4 @@ def test_examples(self):
 if __name__ == '__main__':
 	unittest.main()
 
-# vim: se ts=3:
\ No newline at end of file
+# vim: se ts=3:
diff --git a/test/test_dispatcher_nb.py b/test/test_dispatcher_nb.py
index 552380242ef68dc413c744c065242e4b6497c1db..1bf9cb2c69cfc5454f8a25d16f752dc1b4116c48 100644
--- a/test/test_dispatcher_nb.py
+++ b/test/test_dispatcher_nb.py
@@ -1,8 +1,8 @@
 # tests for xmpppy's dispatcher_nb.py
 import unittest
 
-import testlib
-testlib.setup_env()
+import lib
+lib.setup_env()
 
 from mock import Mock
 
@@ -52,4 +52,4 @@ def _got_message(conn, msg):
 if __name__ == '__main__':
 	unittest.main()
 
-# vim: se ts=3:
\ No newline at end of file
+# vim: se ts=3:
diff --git a/test/test_misc_interface.py b/test/test_misc_interface.py
index 5225e6ea043e6118faacf4dcee7f55b0be687abe..709632bdbda3ce0df86bd2c48a41b1868cd77e63 100644
--- a/test/test_misc_interface.py
+++ b/test/test_misc_interface.py
@@ -1,8 +1,8 @@
 # tests for the miscellaneous functions scattered throughout src/gajim.py
 import unittest
 
-import testlib
-testlib.setup_env()
+import lib
+lib.setup_env()
 
 from common import gajim
 from gajim import Interface
diff --git a/test/test_roster.py b/test/test_roster.py
index 6da8715f92fea0dfa0d1021addcc7a3022b5e94c..21a48a6379cec99f506e0fa7c6685abde7db5bb4 100755
--- a/test/test_roster.py
+++ b/test/test_roster.py
@@ -2,8 +2,8 @@
 
 import time
 
-import testlib
-testlib.setup_env()
+import lib
+lib.setup_env()
 
 from data import *
 
diff --git a/test/test_sessions.py b/test/test_sessions.py
index 1669157d6287d83388de43be1fa6782579db91dd..1699feee74845e87826f68d416cdfddf35e0d988 100644
--- a/test/test_sessions.py
+++ b/test/test_sessions.py
@@ -2,8 +2,8 @@
 
 import time
 
-import testlib
-testlib.setup_env()
+import lib
+lib.setup_env()
 
 from common import gajim
 from common import xmpp