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 5
5
from __future__ import with_statement
6
6
from collections import namedtuple
7
7
8
- import sys
9
8
import os
9
+ import sys
10
10
import mock
11
11
import shlex
12
12
import shutil
@@ -179,6 +179,27 @@ def function_with_bad_docstring(foo):
179
179
assert error_codes == expected_error_codes - ignored
180
180
181
181
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
+
182
203
def test_config_file (env ):
183
204
"""Test that options are correctly loaded from a config file.
184
205
You can’t perform that action at this time.
0 commit comments