Bug 1387555 - [mozlint] After using --edit, run lint check again, r=dylan

MozReview-Commit-ID: BlJbWVv1CeO
This commit is contained in:
Andrew Halberstadt
2017-08-09 10:02:23 -04:00
parent 05e2e56e0b
commit 7bbf1b87c4
2 changed files with 15 additions and 11 deletions

View File

@@ -41,10 +41,14 @@ def test_cli_run_with_fix(run, capfd):
def test_cli_run_with_edit(run, parser, capfd):
os.environ['EDITOR'] = 'echo'
ret = run(['-f', 'json', '--edit', '--linter', 'external'])
out = capfd.readouterr()[0].strip()
assert ret == 0
assert os.path.basename(out) == 'foobar.js'
ret = run(['-f', 'compact', '--edit', '--linter', 'external'])
out, err = capfd.readouterr()
out = out.splitlines()
assert ret == 1
assert len(out) == 5
assert out[0].endswith('foobar.js') # from the `echo` editor
assert "files/foobar.js: line 1, col 1, Error" in out[1]
assert "files/foobar.js: line 2, col 1, Error" in out[2]
del os.environ['EDITOR']
with pytest.raises(SystemExit):