changeset 3923:40f2cce6f6d9

Insert moins path more aggressively into sys.path to win the race against py.test, do insertions less often in make_test_wiki
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Thu, 31 Jul 2008 14:17:49 +0200
parents 8fbdd3667488
children 49bb3b6e3ab5
files MoinMoin/_tests/maketestwiki.py MoinMoin/conftest.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/maketestwiki.py	Sun May 25 23:51:52 2008 +0200
+++ b/MoinMoin/_tests/maketestwiki.py	Thu Jul 31 14:17:49 2008 +0200
@@ -14,7 +14,6 @@
 
 filename = globals().get("__file__") or sys.argv[0]
 moinpath = os.path.abspath(os.path.join(os.path.dirname(filename), os.pardir, os.pardir))
-sys.path.insert(0, moinpath)
 
 from MoinMoin.support import tarfile
 
@@ -62,5 +61,6 @@
     untarUnderlay()
 
 if __name__ == '__main__':
+    sys.path.insert(0, moinpath)
     run()
 
--- a/MoinMoin/conftest.py	Sun May 25 23:51:52 2008 +0200
+++ b/MoinMoin/conftest.py	Thu Jul 31 14:17:49 2008 +0200
@@ -33,7 +33,7 @@
 from MoinMoin._tests import maketestwiki, compat
 modules["unittest"] = compat # evil hack
 
-sys.path.insert(0, str(moindir.join("tests")))
+wikiconfig_dir = str(moindir.join("tests"))
 
 from MoinMoin.support.python_compatibility import set
 
@@ -77,6 +77,9 @@
     if not static_state[0]:
         maketestwiki.run(True)
         static_state[0] = True
+    if sys.path[0] != wikiconfig_dir:
+        sys.path.insert(0, wikiconfig_dir) # this is a race with py.test's collectors
+                                           # because they modify sys.path as well
     request = request_cli.Request()
     request.form = request.args = request.setup_args()
     request.user = User(request)