Modify tests to accept all unclassified files in others.
This commit is contained in:
parent
79678f7e72
commit
e2c64e79a0
@ -70,14 +70,7 @@ classified:
|
||||
files: []
|
||||
tensorflow:
|
||||
executables:
|
||||
files:
|
||||
- /usr/bin/estimator_ckpt_converter
|
||||
- /usr/bin/saved_model_cli
|
||||
- /usr/bin/tensorboard
|
||||
- /usr/bin/tf_upgrade_v2
|
||||
- /usr/bin/tflite_convert
|
||||
- /usr/bin/toco
|
||||
- /usr/bin/toco_from_protos
|
||||
files: []
|
||||
metadata:
|
||||
dirs:
|
||||
- /usr/lib64/python3.7/site-packages/tensorflow-2.1.0.dist-info
|
||||
@ -103,12 +96,17 @@ classified:
|
||||
- /usr/lib/python3.7/site-packages/tensorflow_core
|
||||
type: package
|
||||
other:
|
||||
files: []
|
||||
files:
|
||||
- /usr/bin/estimator_ckpt_converter
|
||||
- /usr/bin/saved_model_cli
|
||||
- /usr/bin/tensorboard
|
||||
- /usr/bin/tf_upgrade_v2
|
||||
- /usr/bin/tflite_convert
|
||||
- /usr/bin/toco
|
||||
- /usr/bin/toco_from_protos
|
||||
tldr:
|
||||
executables:
|
||||
files:
|
||||
- /usr/bin/tldr
|
||||
- /usr/bin/tldr.py
|
||||
files: []
|
||||
metadata:
|
||||
dirs:
|
||||
- /usr/lib/python3.7/site-packages/tldr-0.5.dist-info
|
||||
@ -128,7 +126,9 @@ classified:
|
||||
- /usr/lib/python3.7/site-packages/__pycache__/tldr.cpython-37{,.opt-?}.pyc
|
||||
type: script
|
||||
other:
|
||||
files: []
|
||||
files:
|
||||
- /usr/bin/tldr
|
||||
- /usr/bin/tldr.py
|
||||
|
||||
dumped:
|
||||
- - tensorflow
|
||||
|
@ -155,18 +155,18 @@ def test_parse_record_tensorflow():
|
||||
assert output == expected
|
||||
|
||||
|
||||
def remove_executables(expected):
|
||||
def remove_others(expected):
|
||||
return [p for p in expected if not p.startswith(str(BINDIR))]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_executables", (True, False))
|
||||
@pytest.mark.parametrize("include_auto", (True, False))
|
||||
@pytest.mark.parametrize("package, glob, expected", EXPECTED_FILES)
|
||||
def test_generate_file_list(package, glob, expected, include_executables):
|
||||
def test_generate_file_list(package, glob, expected, include_auto):
|
||||
paths_dict = EXPECTED_DICT[package]
|
||||
modules_glob = {glob}
|
||||
if not include_executables:
|
||||
expected = remove_executables(expected)
|
||||
tested = generate_file_list(paths_dict, modules_glob, include_executables)
|
||||
if not include_auto:
|
||||
expected = remove_others(expected)
|
||||
tested = generate_file_list(paths_dict, modules_glob, include_auto)
|
||||
|
||||
assert tested == expected
|
||||
|
||||
@ -198,17 +198,17 @@ def default_options(output, mock_root):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_executables", (True, False))
|
||||
@pytest.mark.parametrize("include_auto", (True, False))
|
||||
@pytest.mark.parametrize("package, glob, expected", EXPECTED_FILES)
|
||||
def test_cli(tmp_path, package, glob, expected, include_executables):
|
||||
def test_cli(tmp_path, package, glob, expected, include_auto):
|
||||
mock_root = create_root(tmp_path, TEST_RECORDS[package])
|
||||
output = tmp_path / "files"
|
||||
globs = [glob, "+bindir"] if include_executables else [glob]
|
||||
globs = [glob, "+auto"] if include_auto else [glob]
|
||||
cli_args = argparser().parse_args([*default_options(output, mock_root), *globs])
|
||||
main(cli_args)
|
||||
|
||||
if not include_executables:
|
||||
expected = remove_executables(expected)
|
||||
if not include_auto:
|
||||
expected = remove_others(expected)
|
||||
tested = output.read_text()
|
||||
assert tested == "\n".join(expected) + "\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user