Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Named module (-m) support (for Python >= 2.7).
Browse files Browse the repository at this point in the history
  • Loading branch information
Nurdok committed Sep 7, 2016
1 parent 807e79f commit 62610d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
File renamed without changes.
23 changes: 22 additions & 1 deletion src/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from __future__ import with_statement
from collections import namedtuple

import sys
import os
import sys
import mock
import shlex
import shutil
Expand Down Expand Up @@ -179,6 +179,27 @@ def function_with_bad_docstring(foo):
assert error_codes == expected_error_codes - ignored


def test_run_as_named_module():
"""Test that pydocstyle can be run as a "named module".
This means that the following should run pydocstyle:
python -m pydocstyle
"""
# Running a package with "-m" is not supported in Python 2.6
if sys.version_info[0:2] == (2, 6):
return
# Add --match='' so that no files are actually checked (to make sure that
# the return code is 0 and to reduce execution time).
cmd = shlex.split("python -m pydocstyle --match=''")
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
assert p.returncode == 0, out.decode('utf-8') + err.decode('utf-8')


def test_config_file(env):
"""Test that options are correctly loaded from a config file.
Expand Down

0 comments on commit 62610d6

Please sign in to comment.