Skip to content

Commit 8b82f2f

Browse files
authored
Merge pull request #86 from Eric89GXL/better-cmd
FIX: Fix command
2 parents 626a180 + e9d8629 commit 8b82f2f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

bin/codespell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
if __name__ == '__main__':
66
import codespell_lib
7-
sys.exit(codespell_lib.main(*sys.argv))
7+
sys.exit(codespell_lib.main(*sys.argv[1:]))

codespell_lib/tests/test_basic.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import contextlib
66
import os
77
import os.path as op
8+
import subprocess
89
import sys
910
import tempfile
1011
import warnings
@@ -14,6 +15,23 @@
1415
from codespell_lib import main
1516

1617

18+
def run_codespell(args=(), cwd=None):
19+
"""Helper to run codespell"""
20+
return subprocess.Popen(
21+
['codespell.py'] + list(args), cwd=cwd,
22+
stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
23+
24+
25+
def test_command():
26+
"""Test running codespell.py"""
27+
# With no arguments does "."
28+
with TemporaryDirectory() as d:
29+
assert_equal(run_codespell(cwd=d), 0)
30+
with open(op.join(d, 'bad.txt'), 'w') as f:
31+
f.write('abandonned\nAbandonned\nABANDONNED\nAbAnDoNnEd')
32+
assert_equal(run_codespell(cwd=d), 4)
33+
34+
1735
def test_basic():
1836
"""Test some basic functionality"""
1937
assert_equal(main('_does_not_exist_'), 0)

0 commit comments

Comments
 (0)