You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The fsutils.chdircontextmanager should navigate to the chosen directory for the duration of a with statement and then return to the previous working directory. If chdir is unable to navigate to the chosen directory, it should raise an exception. Also, tests should be in place to verify that chdir works as expected.
Current behavior chdir does navigate to the chosen directory, but it always states
WARNING: Unable to chdir({path})
Additionally, when attempting to return to the previous working directory at the end of the with, it states it is unable to yield to it.
Lastly, there are no tests for the entirety of the fsutils module, including the chdircontextmanager.
Machines affected
All
To Reproduce
fromwxflowimportchdirwithchdir("/"):
print("We are now in /")
Context
Found while attempting to engineer a solution for NOAA-EMC/global-workflow#2994, which requires navigating to HOMEgfs to run git commands.
Detailed Description
Nothing further.
Possible Implementation
cwd=os.getcwd()
# Try to change paths.try:
os.chdir(path)
exceptOSError:
raiseOSError(f"Failed to change directory to ({path})")
# If successful, yield to the calling "with" statement.try:
yieldfinally:
# Once the with is complete, head back to the original working directoryos.chdir(cwd)
The text was updated successfully, but these errors were encountered:
Expected behavior
The
fsutils.chdir
contextmanager
should navigate to the chosen directory for the duration of awith
statement and then return to the previous working directory. Ifchdir
is unable to navigate to the chosen directory, it should raise an exception. Also, tests should be in place to verify thatchdir
works as expected.Current behavior
chdir
does navigate to the chosen directory, but it always statesAdditionally, when attempting to return to the previous working directory at the end of the
with
, it states it is unable toyield
to it.Lastly, there are no tests for the entirety of the
fsutils
module, including thechdir
contextmanager
.Machines affected
All
To Reproduce
Context
Found while attempting to engineer a solution for NOAA-EMC/global-workflow#2994, which requires navigating to
HOMEgfs
to rungit
commands.Detailed Description
Nothing further.
Possible Implementation
The text was updated successfully, but these errors were encountered: