django-autocomplete / setup.py

Diff from to
-from setuptools import setup
+import os
+import sys
+
+from setuptools import setup, Command
 import pkg_resources
 import autocomplete
 
 
+class test(Command):
+    description = 'Run the test suite'
+
+    user_options = [
+        ('settings=', 's',
+            'Run the test suite with the specified settings module')
+    ]
+
+    def initialize_options(self):
+        self.settings = None
+
+    def finalize_options(self):
+        if self.settings is None:
+            self.settings = 'test_project.settings'
+
+    def run(self):
+        from django.core.management import call_command
+
+        os.environ['DJANGO_SETTINGS_MODULE'] = self.settings
+        tests_dir = os.path.join(os.path.dirname(__file__), 'tests')
+        sys.path.append(tests_dir)
+
+        call_command('test', 'testapp')
+
+
+
+
 def get_metadata_version():
     """
     Tries to get the version from the django_autocomplete.egg-info directory.
         'Programming Language :: Python',
         'Topic :: Utilities'
     ],
+    cmdclass = {'test': test},
 )
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.