diff options
Diffstat (limited to 'tests/filters/test_size.py')
-rw-r--r-- | tests/filters/test_size.py | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/tests/filters/test_size.py b/tests/filters/test_size.py index 8dda501..95d5479 100644 --- a/tests/filters/test_size.py +++ b/tests/filters/test_size.py @@ -78,31 +78,30 @@ def test_basic(testfs): } -# @pytest.mark.skip(reason="TODO - template vars in filters not supported") -# def test_python_args(tmp_path, mock_echo): -# create_filesystem( -# tmp_path, -# files=[ -# "empty", -# ("full", "0" * 2000), -# ("halffull", "0" * 1010), -# ("two_thirds.txt", "0" * 666), -# ], -# config=""" -# rules: -# - folders: files -# filters: -# - python: | -# return 2000 -# - filesize: '= {python}b' -# actions: -# - echo: '{path.name} {filesize.bytes}' -# """, -# ) -# main(["run", "--config-file=%s" % (tmp_path / "config.yaml")]) -# mock_echo.assert_has_calls( -# [ -# call("full 2000"), -# ], -# any_order=True, -# ) +@pytest.mark.skip(reason="TODO - template vars in filters not supported") +def test_python_args(testfs): + make_files( + testfs, + { + "empty": "", + "full": "0" * 2000, + "halffull": "0" * 1010, + "two_thirds.txt": "0" * 666, + }, + ) + config = """ + rules: + - folders: files + filters: + - python: | + return 2000 + - filesize: '= {python}b' + actions: + - delete + """ + core.run(config=config, working_dir=testfs, simulate=False) + assert read_files(testfs) == { + "empty": "", + "halffull": "0" * 1010, + "two_thirds.txt": "0" * 666, + } |