Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in new test where temp dir should be a repo
The problem was that the path used for environment variables that inform `env::temp_dir()` was a relative path. Although `temp_dir()` itself will return an absolute path (resolved from it), the test changes the current directory. This change occurred between when the relative path was obtained by the test code and when it was resolved by the code under test. The path was therefore resolved to a different location (the last few path components were repeated) that never exists. Since it didn't exist, the `git config -l` command failed, and no installation config file path was returned, causing the test to wrongly pass (since `None` is the correct result when only local scope configuration files are available). The fix is to use an absolute path. In addition, this canonicalizes the path rather than merely resolving it, and does so even before changing directory to it, so that if `temp_dir()` "fixes up" the path in ways beyond resolving it, such as resolving symlinks, the test is less likely to wrongly pass. The test now rightly fails, since the hardening it tests for has not yet been implemented in the code under test. Further changes to the test are still warranted, at least to clean it up, and possibly also to make it slightly more robust.
- Loading branch information