Skip to content

Use pytest config in pyproject.toml in CI#7555

Merged
lagru merged 24 commits intoscikit-image:mainfrom
lagru:no-pytest-config
Jan 31, 2025
Merged

Use pytest config in pyproject.toml in CI#7555
lagru merged 24 commits intoscikit-image:mainfrom
lagru:no-pytest-config

Conversation

@lagru
Copy link
Member

@lagru lagru commented Sep 27, 2024

Description

Closes #7554.

This should be safe, as the pytest documentation states that

rootdir is NOT used to modify sys.path/PYTHONPATH

So while the --config-file option affects the rootdir, it's not adding that directory to the PYTHONPATH where it could accidentally overwrite the installed package.

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

@lagru lagru added the 🤖 type: Infrastructure CI, packaging, tools and automation label Sep 27, 2024
This should be safe, as the pytest documentation [1] states that
"rootdir is NOT used to modify sys.path/PYTHONPATH". So while the
`--config-file` option affects the `rootdir`, it's not adding that
directory to the PYTHONPATH where it could accidentally overwrite the
installed package. This solution is somewhat unsatisfying. Personally,
I think a better approach would be to switch to the src-layout.

[1] https://docs.pytest.org/en/7.1.x/reference/customize.html?highlight=rootdir#initialization-determining-rootdir-and-configfile
@lagru lagru changed the title Debug pytest config not being picked up in tests.yml workflow Use pytest config in pyroject.toml in CI Sep 27, 2024
@lagru lagru marked this pull request as ready for review October 4, 2024 13:00
@stefanv stefanv changed the title Use pytest config in pyroject.toml in CI Use pytest config in pyproject.toml in CI Dec 17, 2024
@lagru
Copy link
Member Author

lagru commented Dec 17, 2024

During the meeting @stefanv suggested to use a different approach and just not step out of the project directory. It was suggested that that may be outdated behavior from a long time ago. 😅

@lagru
Copy link
Member Author

lagru commented Jan 24, 2025

Close in favor of #7670.

@lagru lagru closed this Jan 24, 2025
@lagru lagru reopened this Jan 26, 2025
@stefanv
Copy link
Member

stefanv commented Jan 31, 2025

May not look like it, but we're close 😅

@stefanv
Copy link
Member

stefanv commented Jan 31, 2025

The remaining failure is pyamg related.

@stefanv
Copy link
Member

stefanv commented Jan 31, 2025

Looks like pytest is turning the innocuous warning raised by pyamg into an exception.

@stefanv stefanv force-pushed the no-pytest-config branch 4 times, most recently from 8564112 to f50c1e2 Compare January 31, 2025 07:20
Leaving this commented is probably an oversight from scikit-imagegh-7576 /
a7b54a8.
CIBW_TEST_COMMAND: >
pip list --pre --format=freeze | grep -q 'numpy==2' &&
pytest --pyargs skimage
(cd .. && $PYTEST --pyargs skimage)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check if this actually works after merging this.

'sphinx-copybutton',
'matplotlib>=3.7',
'dask[array]>=2022.9.2',
'dask[array]>=2023.2.0',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing that this is done in accordance with SPEC0?

@pytest.mark.xfail(
Version(np.__version__) >= Version('2.0.0.dev0'),
reason='tifffile uses deprecated attribute `ndarray.newbyteorder`',
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this issue cgohlke/tifffile#238 was addressed in tifffile 2024.1.30.

Should we update to tifffile 2024.1.30? I guess it might be possible that there are some combinations of our dependencies that still raise this warning or even fail but probably rare and fix-able with bumping tifffile or downgrading NumPy.

So I think we can leave tifffile be.

# Don't use the cache provider plugin, as it doesn't work with Pyodide
# right now: https://github.com/pypa/cibuildwheel/issues/1966
# pytest -svra -p no:cacheprovider --pyargs skimage
$PYTEST -svra -p no:cacheprovider --pyargs skimage
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I uncommented this line in c3e6af1. Feel free to revert if I missed something here.

Copy link
Member Author

@lagru lagru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ Approving since I reviewed your changes @stefanv. Thanks for finishing this! 😊

I think this is ready to go in if the CI is happy with me re-enabling testing on the emscripten.

@lagru lagru merged commit 4f02015 into scikit-image:main Jan 31, 2025
25 checks passed
@lagru lagru deleted the no-pytest-config branch January 31, 2025 14:23
@lagru
Copy link
Member Author

lagru commented Jan 31, 2025

Merged since it seems like 2 core devs approved.

matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request Feb 4, 2025
…ailure

* origin/main:
  Add zizmor to pre-commit; address GH workflow issues raised (scikit-image#7662)
  Reenable test marked as flaky on Azure. (scikit-image#7694)
  Simultaneously resolve all dependencies; add pip caching (scikit-image#7690)
  Copy keypoints if necessary to preserve contiguity (scikit-image#7692)
  CI cleanup (scikit-image#7693)
  Port CI testing from Azure to GitHub (scikit-image#7687)
  Lower CI build verbosity
  Use pytest config in pyproject.toml in CI (scikit-image#7555)
  Improve docstring for rolling_ball function. (scikit-image#7682)
@stefanv stefanv added this to the 0.25.2 milestone Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 type: Infrastructure CI, packaging, tools and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pytest config in pyproject.toml isn't used in CI

3 participants