diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index 1b0e011814..865ed01e5f 100644
--- a/django/core/management/commands/test.py
+++ b/django/core/management/commands/test.py
@@ -1,4 +1,5 @@
 from django.core.management.base import BaseCommand
+import sys
 
 class Command(BaseCommand):
     help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.'