Skip to content

Replace brittle os.chdir usage in make.py with a context manager #1726

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

Merged

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Apr 25, 2023

Stacks onto #1725.

Changes

  • Add simple context manager wrapping cd behavior
  • Add helper constants
  • Modify run to accept an optional cd path
  • Add a helper run_doc function combining run with a constant
  • Remove top-level os.chdir
  • Remove brittle use of os.chdir('../') in command functions

This doesn't use a combined decorator function because typer interacts poorly with other decorators.

How to test

The important parts should be covered by this, run as a script or individually.

#!/bin/bash

python make.py html
python make.py clean
python make.py lint
python make.py test
python make.py serve
# Swap to your browser at this point per the in-terminal instructions.

@Cleptomania Cleptomania merged commit c24d930 into pythonarcade:development Apr 25, 2023
@pushfoo pushfoo deleted the make_script_context_manager branch May 7, 2023 06:05
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.

2 participants