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

Unit tests fail without Google storage bucket access #543

Open
mivermeu opened this issue Feb 10, 2025 · 1 comment · May be fixed by #544
Open

Unit tests fail without Google storage bucket access #543

mivermeu opened this issue Feb 10, 2025 · 1 comment · May be fixed by #544

Comments

@mivermeu
Copy link
Contributor

Describe the bug

This is a reference to the pylinac forum post Running pylinac unit tests fails by jmartens (@jmartens), which describes the failure of many unit tests due to the use of proprietary data in an inaccessible Google storage bucket. The relevant unit tests fail with the message "json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)".

I thought it would be useful to track the issue on GitHub as well! This way we can link other issues and pull requests. Feel free to close if you'd like to keep this issue on the forums exclusively.

Steps to reproduce

  1. Clone the most up-to-date version of the project (tested on commit 75e1c2a)
  2. Install the requirements with uv sync --frozen (Use the -p 3.12 flag if necessary)
  3. Run the test suite with uv run pytest

Expected behavior

The unit tests should pass with a clean install of the project.

Proposed solution

Mostly described by jmartens (@jmartens) in the original forum post.

Short term

  • Mark tests that use proprietary data with @pytest.mark.proprietary.
  • Extend the pytest configuration with the following default:
[pytest]
addopts = -m 'not proprietary'
  • Enable all tests in the CI/CD with pytest -m 'proprietary or not proprietary'.

Medium term

  • Designate a storage location for public data: existing demo file location / new bucket / fine-grained permissions in private data storage
  • Collect information on proprietary test data: relevancy, origin, etc.
  • Create a list of missing public test data for people to do targeted donations. This can be newly donated data or data found in public, such as on the pylinac Google group forum.

Long term

  • Replace all non-public test data with public data.

Progress so far

I have done some tentative work on the short term portion of this issue and although there are a lot of marks to place, the method seems sound. The marks also make it easy to spot which tests still use non-public data.

@mivermeu mivermeu linked a pull request Feb 11, 2025 that will close this issue
@jmartens
Copy link
Contributor

Thanks @mivermeu for moving this forward. I did a local step in this direction as well but had not did the time to finalize it and make it a pr yet. 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants