Tarek Ziadé avatar Tarek Ziadé committed d1970db

changed test locally so distribute.egg-info/entry_points.txt is not changed when running tests

Comments (0)

Files changed (1)

 from setuptools import setup, find_packages
 from setuptools.command.build_py import build_py as _build_py
+from setuptools.command.test import test as _test
 scripts = []
 # specific command that is used to generate windows .exe files
                 if copied and srcfile in self.distribution.convert_2to3_doctests:
+class test(_test):
+    """Specific test class to avoid rewriting the entry_points.txt"""
+    def run(self):
+        entry_points = os.path.join('distribute.egg-info', 'entry_points.txt')
+        if not os.path.exists(entry_points):
+            try:
+                _test.run(self)
+            finally:
+                return
+        f = open(entry_points)
+        # running the test
+        try:
+            ep_content = f.read()
+        finally:
+            f.close()
+        try:
+            _test.run(self)
+        finally:
+            # restoring the file
+            f = open(entry_points, 'w')
+            try:
+                f.write(ep_content)
+            finally:
+                f.close()
 # if we are installing Distribute using "python setup.py install"
 # we need to get setuptools out of the way
 def _easy_install_marker():
     from distribute_setup import _before_install
 dist = setup(
     zip_safe = (sys.version>="2.5"),   # <2.5 needs unzipped for -m to work
+    cmdclass = {'test': test},
     entry_points = {
         "distutils.commands" : [
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.