Title: Avoid brittle assumptions about preexisting temporary files in tests by EliahKagan · Pull Request #1759 · gitpython-developers/GitPython · GitHub
Open Graph Title: Avoid brittle assumptions about preexisting temporary files in tests by EliahKagan · Pull Request #1759 · gitpython-developers/GitPython
X Title: Avoid brittle assumptions about preexisting temporary files in tests by EliahKagan · Pull Request #1759 · gitpython-developers/GitPython
Description: May fix #1744 Two tests had previously used tempfile.gettempdir() directly to get a directory to make assertions about, such as not being a valid git repository. One other test had created a repository at a hard-coded location relative to it, which in effect also assumed the availability of that path, a condition that may not hold, due either to GitPython's own previous test runs, unrelated use of those paths in a location like /tmp, or possibly other conditions. This uses newly created directories instead whose contents are known. The tests this makes more robust include test_new_should_raise_on_invalid_repo_location, which is the one reported as failing on OpenIndiana in the build described in #1744. I believe this fully remedies that problem, but I do not believe it with high confidence. I had some trouble getting oi-userland set up in a way that would enable me to efficiently test this, and I would not be sure I had reproduced the precise conditions of the actual build. I believe these improvements are worthwhile even separately from that, since the assumptions about tempfile.gettempdir() and its preexisting contents are minor test bugs in and of themselves. So I'm opening this PR now, but I want to make clear that while I believe this addresses #1744, I cannot be certain. In part to make the tests more comprehensive, and in part because I think it may be relevant to the situation there, this also adds a related test, test_new_should_raise_on_invalid_repo_location_within_repo. This verifies that calling Repo on a directory that is not a git repository and that is known to reside inside a directory that is a git repository gives the same error as we expect when it is not (known to be) inside a repository. A few more details are in commit messages, including on one of the tests that, while being made no longer to use a hard-coded path under tempfile.gettempdir(), now does its cleanup a little differently and cleanup now succeeds on it. So this turns out to be a small step toward #790.
Open Graph Description: May fix #1744 Two tests had previously used tempfile.gettempdir() directly to get a directory to make assertions about, such as not being a valid git repository. One other test had created a reposi...
X Description: May fix #1744 Two tests had previously used tempfile.gettempdir() directly to get a directory to make assertions about, such as not being a valid git repository. One other test had created a reposi...
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1759
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f1172f83-e54d-c846-9d8c-145fc138d19b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A95C:AB0F3:ABA63B:E5969F:6968396D |
| html-safe-nonce | 4caf2d9b1c2c386b6bf98ef907a9d0e3be457be9c763135c236ff4a7b96baa43 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTVDOkFCMEYzOkFCQTYzQjpFNTk2OUY6Njk2ODM5NkQiLCJ2aXNpdG9yX2lkIjoiMzE0MDIyNTk2ODI3MzYzNTY5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f05c9aca4bb80bfc535d97cc917439af1a2da0f2fe39eb542a14832607e3507a |
| hovercard-subject-tag | pull_request:1635712000 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1759/files |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | May fix #1744 Two tests had previously used tempfile.gettempdir() directly to get a directory to make assertions about, such as not being a valid git repository. One other test had created a reposi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25f416bb6d8a5f8624aad6cebc375ab2c50ac58f2175f32a7093325e66e5515 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32212b8b3bddd6432b3b35d27c050b1c22bd8cca |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width