(self)
| 1679 | ON_WINDOWS, reason="Windows does not allow modifying open files" |
| 1680 | ) |
| 1681 | def test_refresh_from_disk(self) -> None: |
| 1682 | # regression test for https://github.com/pydata/xarray/issues/4862 |
| 1683 | |
| 1684 | with create_tmp_file() as example_1_path: |
| 1685 | with create_tmp_file() as example_1_modified_path: |
| 1686 | with open_example_dataset("example_1.nc") as example_1: |
| 1687 | self.save(example_1, example_1_path) |
| 1688 | |
| 1689 | example_1.rh.values += 100 |
| 1690 | self.save(example_1, example_1_modified_path) |
| 1691 | |
| 1692 | a = open_dataset(example_1_path, engine=self.engine).load() |
| 1693 | |
| 1694 | # Simulate external process modifying example_1.nc while this script is running |
| 1695 | shutil.copy(example_1_modified_path, example_1_path) |
| 1696 | |
| 1697 | # Reopen example_1.nc (modified) as `b`; note that `a` has NOT been closed |
| 1698 | b = open_dataset(example_1_path, engine=self.engine).load() |
| 1699 | |
| 1700 | try: |
| 1701 | assert not np.array_equal(a.rh.values, b.rh.values) |
| 1702 | finally: |
| 1703 | a.close() |
| 1704 | b.close() |
| 1705 | |
| 1706 | def test_byte_attrs(self, byte_attrs_dataset: dict[str, Any]) -> None: |
| 1707 | # test for issue #9407 |
no test coverage detected