Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made test for versioning system. #387

Merged

Conversation

MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Mar 9, 2024

Description

This was meant to be a bug fix for #386. However, since this bug I have been unable to replicate the error in CI, or even on the machine had initially had the error.

Nonetheless I saw some opportunities for making this version system more robust.

Background on version system.

How versions were determined changed with #336.
At this point we moved to setuptools-scm, and the version is never hard coded into a git tracked file.
Rather the tool uses git tag and git commits to determine the current/next version.
This is expensive to do so it is only done when python -m build is ran.
At this point the version number is calculated and saved to montepy/_version.py.
It is also possible to figure out the version number by importing setuptools_scm.

To determine the version montepy does the following:

  1. tries to import _version.py and use that.
  2. If that fails it tries to import setuptools_scm
  3. If that fails too, it falls back to Undefined.

Improvements

  1. Improved coverage by testing all branches of this logic in tests/test_version.py. This test is rather jank because it has intentionally unload setuptools_scm and montepy so it can force it re-import multiple times.
  2. Improved CI to always generate a test report even if the tests failed.
  3. Added a catch for a LookupError so if setuptools_scm fails for some reason the user will get Undefined.

Fixes #386

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@MicahGale MicahGale added bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". CI/CD critical An issue that seriously limits user adoption or hampers current use. labels Mar 9, 2024
@MicahGale MicahGale self-assigned this Mar 9, 2024
@MicahGale MicahGale linked an issue Mar 9, 2024 that may be closed by this pull request
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 8211674948

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 98.261%

Totals Coverage Status
Change from base Build 8159050757: 0.1%
Covered Lines: 5762
Relevant Lines: 5864

💛 - Coveralls

* fixed test reporting to still occur if tests failed
* ensured build packages are installed for testing
@MicahGale MicahGale force-pushed the 386-error-with-versioning-without-setuptools-scm-installed branch from 563222c to 7a54524 Compare March 9, 2024 03:21
@idaholab idaholab deleted a comment from coveralls Mar 9, 2024
@MicahGale MicahGale requested a review from tjlaboss March 9, 2024 04:08
tests/test_version.py Show resolved Hide resolved
@MicahGale MicahGale requested a review from tjlaboss April 15, 2024 22:20
@MicahGale MicahGale merged commit 74ae807 into develop Apr 15, 2024
13 checks passed
@MicahGale MicahGale deleted the 386-error-with-versioning-without-setuptools-scm-installed branch April 15, 2024 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". CI/CD critical An issue that seriously limits user adoption or hampers current use.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with Versioning without setuptools-scm installed
3 participants