summaryrefslogtreecommitdiff
path: root/tests/user_commands
diff options
context:
space:
mode:
authorPatrick Michaud <pmichaud@uw.edu>2014-03-22 16:52:05 +0100
committerClaude Paroz <claude@2xlibre.net>2014-03-22 16:54:02 +0100
commit908bdea482d0a5af7a4c9d38ae52ed876d30cbe4 (patch)
treef9d43cfde0df8c4a59c1e6a32a8cb0ebc95a0d33 /tests/user_commands
parent07d4b3c8f28eb73bdbf2b1f61990daf01880e46b (diff)
[1.7.x] Fixed #22256 -- Replaced bad fallback for missing PATH
Thanks Baptiste Mispelon for the review. Backport of acee46fc9 from master.
Diffstat (limited to 'tests/user_commands')
-rw-r--r--tests/user_commands/tests.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
index bf555e66b9..c24a6e7a2d 100644
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -1,8 +1,9 @@
+import os
import sys
from django.core import management
from django.core.management import CommandError
-from django.core.management.utils import popen_wrapper
+from django.core.management.utils import find_command, popen_wrapper
from django.test import SimpleTestCase
from django.utils import translation
from django.utils.six import StringIO
@@ -60,6 +61,19 @@ class CommandTests(SimpleTestCase):
management.call_command('leave_locale_alone_true', stdout=out)
self.assertEqual(out.getvalue(), "pl\n")
+ def test_find_command_without_PATH(self):
+ """
+ find_command should still work when the PATH environment variable
+ doesn't exist (#22256).
+ """
+ current_path = os.environ.pop('PATH', None)
+
+ try:
+ self.assertIsNone(find_command('_missing_'))
+ finally:
+ if current_path is not None:
+ os.environ['PATH'] = current_path
+
class UtilsTests(SimpleTestCase):