mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	[1.7.x] Fixed #23107 -- Made runserver output respect --no-color.
Backport of 67d7da5fb9 from master
			
			
This commit is contained in:
		| @@ -305,6 +305,7 @@ class BaseCommand(object): | ||||
|         if options.get('no_color'): | ||||
|             self.style = no_style() | ||||
|             self.stderr = OutputWrapper(options.get('stderr', sys.stderr)) | ||||
|             os.environ["DJANGO_COLORS"] = "nocolor" | ||||
|         else: | ||||
|             self.stderr = OutputWrapper(options.get('stderr', sys.stderr), self.style.ERROR) | ||||
|  | ||||
|   | ||||
| @@ -1385,6 +1385,7 @@ class CommandTypes(AdminScriptTestCase): | ||||
|         out = StringIO() | ||||
|  | ||||
|         call_command('color_command', no_color=True, stdout=out) | ||||
|         self.assertEqual(os.environ.get('DJANGO_COLORS', ''), 'nocolor') | ||||
|         self.assertEqual(out.getvalue(), 'BEGIN\n') | ||||
|  | ||||
|     def test_base_command(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user