Skip to content

Testing Bugfix: refactor clean --python-cache to support all#31449

Merged
tgamblin merged 1 commit intospack:developfrom
tldahlgren:bugfix-test_function_calls
Jul 6, 2022
Merged

Testing Bugfix: refactor clean --python-cache to support all#31449
tgamblin merged 1 commit intospack:developfrom
tldahlgren:bugfix-test_function_calls

Conversation

@tldahlgren
Copy link
Copy Markdown
Contributor

@tldahlgren tldahlgren commented Jul 5, 2022

I have now had two separate PRs run into the test_function_calls failure when cleaning --python-cache as part of the -a (or --all) case. Specifically, an OSError exception is raised for the python 3.8 check:

   OSError: [Errno 66] Directory not empty: '/Users/runner/work/spack/spack/lib/spack/spack/__pycache__'

All of the other options that are tested by the function mock the associated functionality to simply count the number of calls. However, the python cache functionality was not included since the original function is not amenable to the simple mocking approach. This PR makes the treatment of that option consistent in the test method.

This PR also adds test_remove_python_cache that ensures coverage of the functionality without attempting to remove any files from the Spack instance.

This testing issue/bug has arisen for at least the following PRs:

There were two choices: 1) remove '-p' from '-a' or 2) allow monkeypatching
the cleaning of the python cache since clean's test_function_calls isn't
supposed to be actually cleaning anything.

This commit supports the latter and adds a test case for `-p`.
@tldahlgren tldahlgren force-pushed the bugfix-test_function_calls branch from 7deb8a7 to abd1d6e Compare July 5, 2022 21:59
@tgamblin tgamblin merged commit e68ed32 into spack:develop Jul 6, 2022
bhatiaharsh pushed a commit to bhatiaharsh/spack that referenced this pull request Aug 8, 2022
…1449)

There were two choices: 1) remove '-p' from '-a' or 2) allow monkeypatching
the cleaning of the python cache since clean's test_function_calls isn't
supposed to be actually cleaning anything.

This commit supports the latter and adds a test case for `-p`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants