Skip to content

Commit

Permalink
Merge pull request #86 from Eric89GXL/better-cmd
Browse files Browse the repository at this point in the history
FIX: Fix command
  • Loading branch information
larsoner authored Jun 17, 2016
2 parents 626a180 + e9d8629 commit 8b82f2f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

if __name__ == '__main__':
import codespell_lib
sys.exit(codespell_lib.main(*sys.argv))
sys.exit(codespell_lib.main(*sys.argv[1:]))
18 changes: 18 additions & 0 deletions codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import contextlib
import os
import os.path as op
import subprocess
import sys
import tempfile
import warnings
Expand All @@ -14,6 +15,23 @@
from codespell_lib import main


def run_codespell(args=(), cwd=None):
"""Helper to run codespell"""
return subprocess.Popen(
['codespell.py'] + list(args), cwd=cwd,
stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()


def test_command():
"""Test running codespell.py"""
# With no arguments does "."
with TemporaryDirectory() as d:
assert_equal(run_codespell(cwd=d), 0)
with open(op.join(d, 'bad.txt'), 'w') as f:
f.write('abandonned\nAbandonned\nABANDONNED\nAbAnDoNnEd')
assert_equal(run_codespell(cwd=d), 4)


def test_basic():
"""Test some basic functionality"""
assert_equal(main('_does_not_exist_'), 0)
Expand Down

0 comments on commit 8b82f2f

Please sign in to comment.