Skip to content

[Bug]: Running Tests Overwrites settings.toml Values #927

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

Open
3 tasks done
CyanVoxel opened this issue May 4, 2025 · 2 comments
Open
3 tasks done

[Bug]: Running Tests Overwrites settings.toml Values #927

CyanVoxel opened this issue May 4, 2025 · 2 comments
Labels
Priority: Medium An issue that shouldn't be be saved for last Type: Bug Something isn't working as intended Type: Tests Tests or testing related

Comments

@CyanVoxel
Copy link
Member

Checklist

  • I am using an up-to-date version.
  • I have read the documentation.
  • I have searched existing issues.

TagStudio Version

Alpha 9.5.2 (main branch)

Operating System & Version

macOS 15.4.1

Description

Running the PyTest tests (specifically test_read_settings) overwrites the user's actual settings.toml file with values from the test.

Expected Behavior

Running tests should not affect the user's live files and should instead use mock files and directories for tests.

Steps to Reproduce

  1. Ensure you have a TagStudio settings.toml file, perferably with non-default values
  2. Run the PyTest tests, or at the very least the test_read_settings test
  3. Observe the modified values

Logs

No response

@CyanVoxel CyanVoxel added Priority: Medium An issue that shouldn't be be saved for last Type: Bug Something isn't working as intended Type: Tests Tests or testing related labels May 4, 2025
@CyanVoxel CyanVoxel moved this to 🛠 Ready for Development in TagStudio Development May 4, 2025
@zfbx
Copy link
Contributor

zfbx commented May 5, 2025

I feel like this could of been my fault, but you opened this 3 hours ago but only merged my changes 2 hours ago, was this test using the #903 code?

@CyanVoxel
Copy link
Member Author

I feel like this could of been my fault, but you opened this 3 hours ago but only merged my changes 2 hours ago, was this test using the #903 code?

I tested it on main and had noticed my settings file getting reset occasionally beforehand, but didn't discover the reason until testing #903 - I'm not sure why that PR changed the behavior to write the values from the test instead of resetting it to the default values, but in either case it's undesirable behavior. My assumption is that no matter the temporary library directory being passed to the test, since it's the global settings file it'll always end up pointing to the user's settings.toml file in their system's config directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium An issue that shouldn't be be saved for last Type: Bug Something isn't working as intended Type: Tests Tests or testing related
Projects
Status: 🛠 Ready for Development
Development

No branches or pull requests

2 participants