File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
if __name__ == '__main__' :
6
6
import codespell_lib
7
- sys .exit (codespell_lib .main (* sys .argv ))
7
+ sys .exit (codespell_lib .main (* sys .argv [ 1 :] ))
Original file line number Diff line number Diff line change 5
5
import contextlib
6
6
import os
7
7
import os .path as op
8
+ import subprocess
8
9
import sys
9
10
import tempfile
10
11
import warnings
14
15
from codespell_lib import main
15
16
16
17
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\n Abandonned\n ABANDONNED\n AbAnDoNnEd' )
32
+ assert_equal (run_codespell (cwd = d ), 4 )
33
+
34
+
17
35
def test_basic ():
18
36
"""Test some basic functionality"""
19
37
assert_equal (main ('_does_not_exist_' ), 0 )
You can’t perform that action at this time.
0 commit comments