From 738c8490ec56fc364f4229df2c7c9adca8d1d4f2 Mon Sep 17 00:00:00 2001 From: "Eric N. Vander Weele" Date: Sun, 29 Dec 2019 18:40:09 -0500 Subject: [PATCH] tests: Add integration tests for `--config` and `--isolated` Prevent regressions by adding integration tests to ensure that these options are passed through to `aggregator.aggregate_options()`. --- tests/integration/test_main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py index f3ace53..42ad76c 100644 --- a/tests/integration/test_main.py +++ b/tests/integration/test_main.py @@ -167,3 +167,31 @@ def test_obtaining_args_from_sys_argv_when_not_explicity_provided(capsys): out, err = capsys.readouterr() assert out.startswith('usage: flake8 [options] file file ...\n') assert err == '' + + +def test_cli_config_option_respected(tmp_path): + """Test --config is used.""" + config = tmp_path / "flake8.ini" + config.write_text(u"""\ +[flake8] +ignore = F401 +""") + + py_file = tmp_path / "t.py" + py_file.write_text(u"import os\n") + + _call_main(["--config", str(config), str(py_file)]) + + +def test_cli_isolated_overrides_config_option(tmp_path): + """Test --isolated overrides --config.""" + config = tmp_path / "flake8.ini" + config.write_text(u"""\ +[flake8] +ignore = F401 +""") + + py_file = tmp_path / "t.py" + py_file.write_text(u"import os\n") + + _call_main(["--isolated", "--config", str(config), str(py_file)], retv=1)