From 40eafb224adabb69d28e78d83467c76df2b1821d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Fri, 11 Aug 2023 17:37:02 +0200 Subject: [PATCH] Fix test_spec_parser_make_dummy_sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nikola Forró --- tests/unit/test_spec_parser.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/unit/test_spec_parser.py b/tests/unit/test_spec_parser.py index 2d3faea..3c3f1f1 100644 --- a/tests/unit/test_spec_parser.py +++ b/tests/unit/test_spec_parser.py @@ -83,13 +83,10 @@ def test_spec_parser_make_dummy_sources(tmp_path): assert sourcedir / existing_source not in dummy_sources assert all(not s.exists() for s in dummy_sources) assert (sourcedir / existing_source).exists() - read_only_sourcedir = tmp_path / "read-only-sources" - read_only_sourcedir.mkdir() - (read_only_sourcedir / existing_source).write_text("...") - read_only_sourcedir.chmod(0o555) - parser = SpecParser(read_only_sourcedir) + flexmock(Path).should_receive("write_bytes").and_raise(FileNotFoundError) + flexmock(Path).should_receive("write_text").and_raise(PermissionError) with parser._make_dummy_sources( {regular_source, existing_source}, {non_empty_source} ) as dummy_sources: assert not dummy_sources - assert (read_only_sourcedir / existing_source).exists() + assert (sourcedir / existing_source).exists()