Skip to content

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

Closed
ceblanton wants to merge 1 commit intoNOAA-GFDL:mainfrom
ceblanton:738.pytest-cwd-fixes
Closed

Use pytest fixtures for temporary paths to fix cwd dependency in fre make tests#793
ceblanton wants to merge 1 commit 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.

@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
…make tests.

Make YAMLPATH absolute, replace getcwd with tmp_path, use session tmp for interdependent tests.
Resolves issue NOAA-GFDL#738.
@ilaflott ilaflott force-pushed the 738.pytest-cwd-fixes branch from cac6746 to dc37e57 Compare March 30, 2026 15:59
@ilaflott
Copy link
Copy Markdown
Member

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.

fair enough

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

pytest fixtures for tmpdir == good idea always

@ceblanton
Copy link
Copy Markdown
Contributor Author

closing in favor of #808

@ceblanton ceblanton closed this Mar 31, 2026
Copilot AI added a commit that referenced this pull request Apr 9, 2026
Install a custom sys.excepthook in the fre() entry point that suppresses
Python tracebacks at default and -v verbosity levels. At -vv (DEBUG), the
full traceback is shown. At lower levels, only the exception type and
message are printed, along with a hint to use 'fre -vv ...' for more
detail.

Closes #793

Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/d594a572-8566-467b-9a96-4b233d712582

Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
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