Skip to content

Commit 8079df5

Browse files
committed
encountered a problem
1 parent df5ea3d commit 8079df5

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

docs/todo.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
## Desired
1212

1313
- project logo
14+
- if configuration for given FILE is empty,
15+
report an error, see TODO in CLI main tests
16+
- rename `xrlint.cli.CliEngine` into `xrlint.cli.XRLint`
17+
(with similar API as the `ESLint` class) and export it
18+
from `xrlint.all`. Value of `FILES` should be passed to
19+
`verify_datasets()` methods.
1420
- use `RuleMeta.docs_url` in formatters to create links
1521
- implement xarray backend for xcube 'levels' format
1622
so can validate them too
17-
- rename `xrlint.cli.CliEngine` into `xrlint.cli.XRLint`
18-
(with similar API as the `ESLint` class) and export it
19-
from `xrlint.all`
2023
- add some more tests so we reach 99% coverage
2124
- support rule op args/kwargs schema validation
2225
- support CLI option `--print-config FILE`, see ESLint

tests/cli/test_main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
from xrlint.version import version
1212
from .helpers import text_file
1313

14+
no_match_config_yaml = """
15+
- ignores: ['**/*.nc', '**/*.zarr']
16+
rules:
17+
dataset-title-attr: error
18+
"""
19+
20+
no_match_config_yaml = "[]"
21+
1422

1523
# noinspection PyTypeChecker
1624
class CliMainTest(TestCase):
@@ -179,6 +187,14 @@ def test_files_with_format_option(self):
179187
self.assertIn('"results": [\n', result.output)
180188
self.assertEqual(0, result.exit_code)
181189

190+
def test_file_does_not_match(self):
191+
with text_file(DEFAULT_CONFIG_FILE_YAML, no_match_config_yaml):
192+
runner = CliRunner()
193+
result = runner.invoke(main, ["test.zarr"])
194+
# TODO: make this assertion work
195+
# self.assertIn("No configuration matches this file.", result.output)
196+
self.assertEqual(1, result.exit_code)
197+
182198
def test_files_with_invalid_format_option(self):
183199
runner = CliRunner()
184200
result = runner.invoke(main, ["-f", "foo"] + self.files)

0 commit comments

Comments
 (0)