mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Added "python -m configurations" entry point.
inspired by e0a46367df/django/__main__.py (L1-L9)
see also https://code.djangoproject.com/ticket/24857
This commit is contained in:
parent
1dce659946
commit
089a039efa
2 changed files with 26 additions and 0 deletions
10
configurations/__main__.py
Normal file
10
configurations/__main__.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"""
|
||||
invokes django-cadmin when the configurations module is run as a script.
|
||||
|
||||
Example: python -m configurations check
|
||||
"""
|
||||
|
||||
from .management import execute_from_command_line
|
||||
|
||||
if __name__ == "__main__":
|
||||
execute_from_command_line()
|
||||
|
|
@ -106,6 +106,22 @@ class MainTests(TestCase):
|
|||
stdout=subprocess.PIPE)
|
||||
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
|
||||
|
||||
def test_configuration_argument_in_runypy_cli(self):
|
||||
"""
|
||||
Verify that's configuration option has been added to managements
|
||||
commands when using the -m entry point
|
||||
"""
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, '-m', 'configurations', 'test', '--help'],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, '-m', 'configurations', 'runserver', '--help'],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
|
||||
|
||||
def test_django_setup_only_called_once(self):
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, os.path.join(os.path.dirname(__file__),
|
||||
|
|
|
|||
Loading…
Reference in a new issue