Blob Blame History Raw
diff -Naur networkx-1.9.orig/networkx/tests/test.py networkx-1.9/networkx/tests/test.py
--- networkx-1.9.orig/networkx/tests/test.py	2014-06-25 11:50:58.000000000 -0600
+++ networkx-1.9/networkx/tests/test.py	2014-06-30 12:00:00.000000000 -0600
@@ -2,6 +2,24 @@
 import sys
 from os import path,getcwd
 
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+    try:
+        return pkg_resources.require(requirement)
+    except pkg_resources.VersionConflict:
+        e = sys.exc_info()[1]
+        dist=e.args[0]
+        req=e.args[1]
+        if dist.key == req.key and not dist.location.endswith('.egg'):
+            del pkg_resources.working_set.by_key[dist.key]
+            # We assume there is no need to adjust sys.path
+            # and the associated pkg_resources.working_set.entries
+            return pkg_resources.require(requirement)
+
 def run(verbosity=1,doctest=False,numpy=True):
     """Run NetworkX tests.
 
@@ -16,6 +34,8 @@
     numpy: bool, optional
       True to test modules dependent on numpy
     """
+    replace_dist("nose >= 1.0")
+
     try:
         import nose
     except ImportError: