Skip to content

Commit 089a039

Browse files
graingertAsif Saif Uddin
authored andcommitted
1 parent 1dce659 commit 089a039

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

configurations/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""
2+
invokes django-cadmin when the configurations module is run as a script.
3+
4+
Example: python -m configurations check
5+
"""
6+
7+
from .management import execute_from_command_line
8+
9+
if __name__ == "__main__":
10+
execute_from_command_line()

tests/test_main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ def test_configuration_argument_in_cli(self):
106106
stdout=subprocess.PIPE)
107107
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
108108

109+
def test_configuration_argument_in_runypy_cli(self):
110+
"""
111+
Verify that's configuration option has been added to managements
112+
commands when using the -m entry point
113+
"""
114+
proc = subprocess.Popen(
115+
[sys.executable, '-m', 'configurations', 'test', '--help'],
116+
stdout=subprocess.PIPE,
117+
)
118+
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
119+
proc = subprocess.Popen(
120+
[sys.executable, '-m', 'configurations', 'runserver', '--help'],
121+
stdout=subprocess.PIPE,
122+
)
123+
self.assertIn('--configuration', proc.communicate()[0].decode('utf-8'))
124+
109125
def test_django_setup_only_called_once(self):
110126
proc = subprocess.Popen(
111127
[sys.executable, os.path.join(os.path.dirname(__file__),

0 commit comments

Comments
 (0)