Skip to content

Commit

Permalink
Fix test_spec_parser_make_dummy_sources (#274)
Browse files Browse the repository at this point in the history
Fix test_spec_parser_make_dummy_sources

The chmod way is unreliable and the test fails in Testing Farm (hopefully packit/packit-service#2122 will be fixed soon so we can get CI back 🙂).

Reviewed-by: Laura Barcziová
  • Loading branch information
softwarefactory-project-zuul[bot] authored Aug 14, 2023
2 parents 56360c0 + 40eafb2 commit 901ca42
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/unit/test_spec_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 901ca42

Please sign in to comment.