<#12298 `test_invalidated_after_parent_deletion` i...
# github-notifications
q
#12298 `test_invalidated_after_parent_deletion` in `fs_test.py` is flaky Issue created by wilsonliam See #12297; especially this comment.
Copy code
=================================== FAILURES ===================================
____________________ test_invalidated_after_parent_deletion ____________________

rule_runner = RuleRunner(build_root=/tmp/_BUILD_ROOTi3s8cytb)

    def test_invalidated_after_parent_deletion(rule_runner: RuleRunner) -> None:
        """Test that FileContent is invalidated after deleting parent directory."""
        setup_fs_test_tar(rule_runner)
    
        def read_file() -> Optional[str]:
            digest_contents = rule_runner.request(DigestContents, [PathGlobs(["a/b/1.txt"])])
            if not digest_contents:
                return None
            assert len(digest_contents) == 1
            return digest_contents[0].content.decode()
    
        # Read the original file so that we have nodes to invalidate.
        assert read_file() == "one\n"
    
        shutil.rmtree(Path(rule_runner.build_root, "a/b"))
>       assert try_with_backoff(lambda: read_file() is None)

src/python/pants/engine/fs_test.py:967: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/python/pants/engine/fs_test.py:123: in try_with_backoff
    if assertion_fn():
src/python/pants/engine/fs_test.py:967: in <lambda>
    assert try_with_backoff(lambda: read_file() is None)
src/python/pants/engine/fs_test.py:957: in read_file
    digest_contents = rule_runner.request(DigestContents, [PathGlobs(["a/b/1.txt"])])
src/python/pants/testutil/rule_runner.py:212: in request
    self.scheduler.product_request(output_type, [Params(*inputs)])
src/python/pants/engine/internals/scheduler.py:561: in product_request
    self._raise_on_error([t for _, t in throws])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pants.engine.internals.scheduler.SchedulerSession object at 0x7f21e09fad90>
throws = [Throw(exc=Exception('No such file or directory (os error 2)'), python_traceback='Traceback (no traceback):\n  <pants native internals>\nException: No such file or directory (os error 2)', engine_traceback=['snapshot', 'select'])]

    def _raise_on_error(self, throws: list[Throw]) -> NoReturn:
        exception_noun = pluralize(len(throws), "Exception")
    
        if self._scheduler.include_trace_on_error:
            throw = throws[0]
            etb = throw.engine_traceback
            python_traceback_str = throw.python_traceback or ""
            engine_traceback_str = ""
            others_msg = f"\n(and {len(throws) - 1} more)" if len(throws) > 1 else ""
            if etb:
                sep = "\n  in "
                engine_traceback_str = "Engine traceback:" + sep + sep.join(reversed(etb)) + "\n"
            raise ExecutionError(
                f"{exception_noun} encountered:\n\n"
                f"{engine_traceback_str}"
                f"{python_traceback_str}"
                f"{others_msg}",
>               wrapped_exceptions=tuple(t.exc for t in throws),
            )
E           pants.engine.internals.scheduler.ExecutionError: 1 Exception encountered:
E           
E           Engine traceback:
E             in select
E             in snapshot
E           Traceback (no traceback):
E             <pants native internals>
E           Exception: No such file or directory (os error 2)

src/python/pants/engine/internals/scheduler.py:501: ExecutionError
- generated xml file: /tmp/process-executionwVWltv/src.python.pants.engine.fs_test.py.tests.xml -
pantsbuild/pants