File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,18 @@ def main(argv=None):
8
8
parser = _get_parser ()
9
9
args = parser .parse_args (argv )
10
10
11
+ stdout = []
11
12
for fl in args .infiles :
12
13
content = fl .read ()
13
14
out = blacktex .clean (content , args .keep_comments , args .keep_dollar_math )
14
15
if args .in_place :
15
16
with open (fl .name , "w" ) as f :
16
17
f .write (out )
17
18
else :
18
- print (out )
19
+ stdout .append (out )
20
+
21
+ if not args .in_place :
22
+ return "\n " .join (stdout )
19
23
20
24
21
25
def _get_parser ():
Original file line number Diff line number Diff line change @@ -8,12 +8,9 @@ def test_cli():
8
8
with tempfile .TemporaryDirectory () as tmpdir :
9
9
tmpdir = Path (tmpdir )
10
10
infile = tmpdir / "in.tex"
11
- outfile = tmpdir / "out.tex"
12
11
with open (infile , "w" ) as f :
13
12
f .write ("a+b=c" )
14
13
15
- blacktex .cli .main ([str (infile ), str ( outfile )])
14
+ stdout = blacktex .cli .main ([str (infile )])
16
15
17
- with open (outfile ) as f :
18
- line = f .read ()
19
- assert line == "a+b = c"
16
+ assert stdout == "a+b = c"
You can’t perform that action at this time.
0 commit comments