Skip to content

The "test_checksum" unit test fails spuriously #28021

@alalazo

Description

@alalazo

Steps to reproduce

Sometimes, when running CI on Github Actions, PRs report failures on the test_checksum unit test. The failures seem to be spurious, since re-running the same tests usually makes them pass.

Error message

==================================== ERRORS ====================================
__ ERROR at teardown of test_checksum[arguments0-versions of preferred-test] ___

request = <SubRequest 'check_for_leftover_stage_files' for <Function test_checksum[arguments0-versions of preferred-test]>>
mock_stage = '/tmp/pytest-of-runner/pytest-0/mock-stage2'
ignore_stage_files = {'.lock', 'build_cache', 'spack-src', 'spack-stage-j44yj070'}

    @pytest.fixture(scope='function', autouse=True)
    def check_for_leftover_stage_files(request, mock_stage, ignore_stage_files):
        """
        Ensure that each (mock_stage) test leaves a clean stage when done.
    
        Tests that are expected to dirty the stage can disable the check by
        adding::
    
            @pytest.mark.disable_clean_stage_check
    
        and the associated stage files will be removed.
        """
        stage_path = mock_stage
    
        yield
    
        files_in_stage = set()
        try:
            stage_files = os.listdir(stage_path)
            files_in_stage = set(stage_files) - ignore_stage_files
        except OSError as err:
            if err.errno == errno.ENOENT:
                pass
            else:
                raise
    
        if 'disable_clean_stage_check' in request.keywords:
            # clean up after tests that are expected to be dirty
            for f in files_in_stage:
                path = os.path.join(stage_path, f)
                remove_whatever_it_is(path)
        else:
            ignore_stage_files |= files_in_stage
>           assert not files_in_stage
E           AssertionError: assert not {'spack-stage-j44yj070'}

lib/spack/spack/test/conftest.py:389: AssertionError

Information on your system

The error message was taken from here:

but there are many other similar cases

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingciIssues related to Continuous Integrationimpact-lowmaintainerstestsGeneral test capability(ies)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions