mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Merge pull request #326 from tomchristie/seperate-tests-app
Push tests into a seperate app namespace 'rest_framework.test'
This commit is contained in:
		
						commit
						1eb56ebdd9
					
				| 
						 | 
				
			
			@ -32,7 +32,7 @@ def main():
 | 
			
		|||
    else:
 | 
			
		||||
        print usage()
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
    failures = test_runner.run_tests(['rest_framework' + test_case])
 | 
			
		||||
    failures = test_runner.run_tests(['tests' + test_case])
 | 
			
		||||
 | 
			
		||||
    sys.exit(failures)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,6 +91,7 @@ INSTALLED_APPS = (
 | 
			
		|||
    # 'django.contrib.admindocs',
 | 
			
		||||
    'rest_framework',
 | 
			
		||||
    'rest_framework.authtoken',
 | 
			
		||||
    'rest_framework.tests'
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
STATIC_URL = '/static/'
 | 
			
		||||
| 
						 | 
				
			
			@ -100,14 +101,6 @@ import django
 | 
			
		|||
if django.VERSION < (1, 3):
 | 
			
		||||
    INSTALLED_APPS += ('staticfiles',)
 | 
			
		||||
 | 
			
		||||
# OAuth support is optional, so we only test oauth if it's installed.
 | 
			
		||||
try:
 | 
			
		||||
    import oauth_provider
 | 
			
		||||
except ImportError:
 | 
			
		||||
    pass
 | 
			
		||||
else:
 | 
			
		||||
    INSTALLED_APPS += ('oauth_provider',)
 | 
			
		||||
 | 
			
		||||
# If we're running on the Jenkins server we want to archive the coverage reports as XML.
 | 
			
		||||
import os
 | 
			
		||||
if os.environ.get('HUDSON_URL', None):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +0,0 @@
 | 
			
		|||
"""
 | 
			
		||||
Force import of all modules in this package in order to get the standard test
 | 
			
		||||
runner to pick up the tests.  Yowzers.
 | 
			
		||||
"""
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
modules = [filename.rsplit('.', 1)[0]
 | 
			
		||||
           for filename in os.listdir(os.path.dirname(__file__))
 | 
			
		||||
           if filename.endswith('.py') and not filename.startswith('_')]
 | 
			
		||||
__test__ = dict()
 | 
			
		||||
 | 
			
		||||
for module in modules:
 | 
			
		||||
    exec("from rest_framework.tests.%s import *" % module)
 | 
			
		||||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ class RESTFrameworkModel(models.Model):
 | 
			
		|||
    Base for test models that sets app_label, so they play nicely.
 | 
			
		||||
    """
 | 
			
		||||
    class Meta:
 | 
			
		||||
        app_label = 'rest_framework'
 | 
			
		||||
        app_label = 'tests'
 | 
			
		||||
        abstract = True
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								rest_framework/tests/tests.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								rest_framework/tests/tests.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
"""
 | 
			
		||||
Force import of all modules in this package in order to get the standard test
 | 
			
		||||
runner to pick up the tests.  Yowzers.
 | 
			
		||||
"""
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
modules = [filename.rsplit('.', 1)[0]
 | 
			
		||||
           for filename in os.listdir(os.path.dirname(__file__))
 | 
			
		||||
           if filename.endswith('.py') and not filename.startswith('_')]
 | 
			
		||||
__test__ = dict()
 | 
			
		||||
 | 
			
		||||
for module in modules:
 | 
			
		||||
    exec("from rest_framework.tests.%s import *" % module)
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user