This repository was archived by the owner on Nov 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 55from __future__ import with_statement
66from collections import namedtuple
77
8- import sys
98import os
9+ import sys
1010import mock
1111import shlex
1212import shutil
@@ -179,6 +179,27 @@ def function_with_bad_docstring(foo):
179179 assert error_codes == expected_error_codes - ignored
180180
181181
182+ def test_run_as_named_module ():
183+ """Test that pydocstyle can be run as a "named module".
184+
185+ This means that the following should run pydocstyle:
186+
187+ python -m pydocstyle
188+
189+ """
190+ # Running a package with "-m" is not supported in Python 2.6
191+ if sys .version_info [0 :2 ] == (2 , 6 ):
192+ return
193+ # Add --match='' so that no files are actually checked (to make sure that
194+ # the return code is 0 and to reduce execution time).
195+ cmd = shlex .split ("python -m pydocstyle --match=''" )
196+ p = subprocess .Popen (cmd ,
197+ stdout = subprocess .PIPE ,
198+ stderr = subprocess .PIPE )
199+ out , err = p .communicate ()
200+ assert p .returncode == 0 , out .decode ('utf-8' ) + err .decode ('utf-8' )
201+
202+
182203def test_config_file (env ):
183204 """Test that options are correctly loaded from a config file.
184205
You can’t perform that action at this time.
0 commit comments