Updated tests for config to get more code coverage

This commit is contained in:
Robert O'Shea 2022-07-30 21:51:08 +01:00
parent cad8e14c59
commit d6a17df3e6
1 changed files with 14 additions and 6 deletions

View File

@ -1782,13 +1782,21 @@ def test_help_and_version_after_argument_error(pytester: Pytester) -> None:
def test_filename_too_long(pytester: Pytester) -> None: def test_filename_too_long(pytester: Pytester) -> None:
path_str = ( path_str = (
"this is an extremely long path that should cause the runtime to complain and give" "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ " an error of the type UsageError despite make this path pretty long before I" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ " still have to keep going to make sure that this usage error pops so the code" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ " coverage captures it xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
) )
paths = path_str.split(" ") config = pytester.parseconfig()
result = pytester.runpytest(os.path.join(*paths)) config.known_args_namespace.file_or_dir.append(path_str)
pytest.raises(
UsageError,
config.pluginmanager._set_initial_conftests,
config.known_args_namespace,
rootpath=config.rootpath,
)
result = pytester.runpytest(path_str)
assert result.ret == ExitCode.USAGE_ERROR assert result.ret == ExitCode.USAGE_ERROR