|
1 | | -from typing import Union |
2 | 1 | from unittest.mock import patch |
3 | 2 |
|
4 | 3 | import pytest |
@@ -26,19 +25,27 @@ def test_unsupported_platform(): |
26 | 25 |
|
27 | 26 |
|
28 | 27 | @pytest.mark.parametrize( |
29 | | - "config_path, result_flags", |
30 | | - [(None, ""), (".squawk.toml", "--config=.squawk.toml")], |
31 | | - ids=["Without config", "With config"], |
| 28 | + "params, result_flags", |
| 29 | + [ |
| 30 | + ({}, ""), |
| 31 | + ({"config_path": ".squawk.toml"}, "--config=.squawk.toml"), |
| 32 | + ({"pg_version": "13.0"}, " --pg-version=13.0"), |
| 33 | + ( |
| 34 | + {"config_path": ".squawk.toml", "pg_version": "13.0"}, |
| 35 | + "--config=.squawk.toml --pg-version=13.0", |
| 36 | + ), |
| 37 | + ], |
| 38 | + ids=["Without params", "With config", "With pg version", "With all params"], |
32 | 39 | ) |
33 | 40 | @patch("migration_lint.__path__", ["path"]) |
34 | 41 | @patch("sys.platform", "linux") |
35 | | -def test_squawk_command(config_path: Union[str, None], result_flags: str): |
| 42 | +def test_squawk_command(params: dict, result_flags: str): |
36 | 43 | ignored_rules = ["ignored-rule"] |
37 | 44 |
|
38 | 45 | with patch.object( |
39 | 46 | SquawkLinter, "ignored_rules", new_callable=lambda: ignored_rules |
40 | 47 | ): |
41 | | - linter = SquawkLinter(config_path) |
| 48 | + linter = SquawkLinter(**params) |
42 | 49 |
|
43 | 50 | result = linter.squawk_command(FAKE_STATEMENT) |
44 | 51 |
|
|
0 commit comments