This make the internal shell a bit more like a regular shell. When 'cd' is executed, it just use chdir for example. This is more reliable as it is really hard to audit everything that might use the current working directory.
This works as is because we always chdir at the start of a test execution.
The next steps probably are
- Change the environment to be managed the same way.
- Implement export
- Implement environment variables expansion like $PATH
- Maybe use subprocess.run to have an fully isolated process for each test run. I think this is pretty much necessary if we are to implement subshells