Skip to content

RepoSplit/tests: ensure test_import_package does not use 'builtin'#50584

Merged
haampie merged 7 commits intospack:developfrom
tldahlgren:reposplit_test_import_package
Jun 2, 2025
Merged

RepoSplit/tests: ensure test_import_package does not use 'builtin'#50584
haampie merged 7 commits intospack:developfrom
tldahlgren:reposplit_test_import_package

Conversation

@tldahlgren
Copy link
Copy Markdown
Contributor

@tldahlgren tldahlgren commented May 20, 2025

This PR updates test/packages.py::TestPackage::test_import_package to ensure the unit test does not depend on the builtin build systems that are automatically added by spack.repo._PrependFileLoader (see

self.prepend = b"from spack_repo.builtin.build_systems._package_api_v1 import *\n"
).

By-passing the problem I reported earlier with cmd/edit.py that occurs when the builtin repository is not available (see #50585), the unit test would otherwise fail as follows:

FAILED lib/spack/spack/test/packages.py::TestPackage::test_import_package - ModuleNotFoundError: No module named 'spack_repo'

@tldahlgren tldahlgren requested review from alalazo and haampie May 20, 2025 20:26
@spackbot-app spackbot-app bot added core PR affects Spack core functionality stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies) labels May 20, 2025
@haampie
Copy link
Copy Markdown
Member

haampie commented May 23, 2025

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented May 23, 2025

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented May 23, 2025

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: import, isort, black, flake8, mypy
==> Modified files
  lib/spack/spack/cmd/edit.py
  lib/spack/spack/test/packages.py
==> Running import checks
  import checks were clean
==> Running isort checks
  isort checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/edit.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
Success: no issues found in 611 source files
  mypy checks were clean
==> spack style checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@tldahlgren tldahlgren added this to the v1.0.0 milestone May 28, 2025
haampie
haampie previously approved these changes Jun 2, 2025
@haampie haampie enabled auto-merge (squash) June 2, 2025 18:06
@haampie haampie disabled auto-merge June 2, 2025 19:56
@haampie haampie merged commit 48b87cb into spack:develop Jun 2, 2025
33 of 34 checks passed
@tldahlgren tldahlgren deleted the reposplit_test_import_package branch June 2, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality shell-support stand-alone-tests Stand-alone (or smoke) tests for installed packages tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants