Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #22068 -- Made runtests.py remove trailing slashes from test la…

…bels.

When using tab-completion it's easy to accidentally run a test with
a trailing slash, which causes INSTALLED_APPS to be set incorrectly.
Normalize the test labels to avoid this common error.

Thanks MattBlack for the suggestion.
  • Loading branch information...
commit 68efbfde5e35013c14c0c30cabb1c94b80a48807 1 parent 42736ac
@prestontimmons prestontimmons authored timgraham committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 tests/runtests.py
View
4 tests/runtests.py
@@ -340,6 +340,10 @@ def paired_tests(paired_test, options, test_labels):
'--selenium', action='store_true', dest='selenium', default=False,
help='Run the Selenium tests as well (if Selenium is installed)')
options = parser.parse_args()
+
+ # Allow including a trailing slash on app_labels for tab completion convenience
+ options.modules = [os.path.normpath(labels) for labels in options.modules]
+
if options.settings:
os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
else:
Please sign in to comment.
Something went wrong with that request. Please try again.