Skip to content

Use pytest fixtures for temporary paths to fix cwd dependency in fre make tests#793

Open
ceblanton wants to merge 2 commits intoNOAA-GFDL:mainfrom
ceblanton:738.pytest-cwd-fixes
Open

Use pytest fixtures for temporary paths to fix cwd dependency in fre make tests#793
ceblanton wants to merge 2 commits intoNOAA-GFDL:mainfrom
ceblanton:738.pytest-cwd-fixes

Conversation

@ceblanton
Copy link
Copy Markdown
Contributor

Make YAMLPATH absolute, replace getcwd with tmp_path, use session tmp for interdependent tests. Resolves issue #738.

Describe your changes

Asked copilot to fix #738 using pytest fixtures to ensure a temporary directory is always available.

Issue ticket number and link (if applicable)

#738

Checklist before requesting a review

  • I ran my code
  • I tried to make my code readable
  • I tried to comment my code
  • I wrote a new test, if applicable
  • I wrote new instructions/documentation, if applicable
  • I ran pytest and inspected it's output
  • I ran pylint and attempted to implement some of it's feedback
  • No print statements; all user-facing info uses logging module

Note: If you are a code maintainer updating the tag or releasing a new fre-cli version, please use the release_procedure.md template. To quickly use this template, open a new pull request, choose your branch, and add ?template=release_procedure.md to the end of the url.

…make tests.

Make YAMLPATH absolute, replace getcwd with tmp_path, use session tmp for interdependent tests.
Resolves issue NOAA-GFDL#738.
@ilaflott
Copy link
Copy Markdown
Member

ilaflott commented Mar 23, 2026

using relative pathing is almost as bad as using the current working directory.

try using site.getsitepackages()

@ceblanton
Copy link
Copy Markdown
Contributor Author

using relative pathing is almost as bad as using the current working directory.

try using site.getsitepackages()

I don't understand.. this PR uses relative path from the pytest file, not relative path of the user.

I really think this pytest tmpdir fixture is the most recommended way to manage pytest work directories.

@ceblanton ceblanton marked this pull request as ready for review March 27, 2026 14:08
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 this pull request may close these issues.

fre make tests use getcwd

2 participants