Whole file
GoogleCloudPlatform/terraform-python-testing-helper
The author described this change as “Fix: preserve absolute Path object for tfdir (#91)”. It counts as a record because the check below fails on the code as it stood at 4d4fca5f4 and passes on 17972f5a0, with nothing else changed between the two runs.
Fix saved2026-03-31
Sharing licenceApache-2.0 · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Fix: preserve absolute Path object for tfdir (#91)
The change
| 349 | 349 | """Make relative path absolute from base dir.""" | |
| 350 | 350 | path_obj = Path(path) | |
| 351 | 351 | if path_obj.is_absolute(): | |
| 352 | - | return str(path_obj) | |
| 352 | + | return path | |
| 353 | 353 | return str(Path(self._basedir) / path) | |
| 354 | 354 | ||
| 355 | 355 | def _dirhash(self, directory, hash, ignore_hidden=False, | |
| ⋯ | |||
| 429 | 429 | return func(self, **kwargs) | |
| 430 | 430 | ||
| 431 | 431 | cache_dir = self.cache_dir / \ | |
| 432 | - | Path(sha1(self.tfdir.encode("cp037")).hexdigest()) / \ | |
| 432 | + | Path(sha1(str(self.tfdir).encode("cp037")).hexdigest()) / \ | |
| 433 | 433 | Path(func.__name__) | |
| 434 | 434 | cache_dir.mkdir(parents=True, exist_ok=True) | |
| 435 | 435 | ||
The check that tells the two apart
fail→pass·test/test_tfdir_path.py::test_tfdir_as_path
Check file test/test_tfdir_path.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it4d4fca5f4972abe2ed2b6929244af4ac6a41792f
Broken version dated2026-03-31
Moduletftest
Units changedTerraformTest
Fingerprintd97b62cbba0e72d3
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.