소스 검색

Install tox locally if it wasn't already installed when running setup.py test

Mark Haines 8 년 전
부모
커밋
fd246fde89
1개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 10 2
      setup.py

+ 10 - 2
setup.py

@@ -51,7 +51,16 @@ class Tox(Command):
 
     def run(self):
         #import here, cause outside the eggs aren't loaded
-        import tox
+        try:
+            import tox
+        except ImportError:
+            try:
+                self.distribution.fetch_build_eggs("tox")
+                import tox
+            except:
+                raise RuntimeError(
+                    "The tests need 'tox' to run. Please install 'tox'."
+                )
         import shlex
         args = self.tox_args
         if args:
@@ -75,6 +84,5 @@ setup(
     zip_safe=False,
     long_description=long_description,
     scripts=["synctl"] + glob.glob("scripts/*"),
-    tests_require=['tox'],
     cmdclass={'test': Tox},
 )