(monkeypatch)
| 710 | |
| 711 | |
| 712 | def test__get_paths(monkeypatch): |
| 713 | # These settings are used by Dask's config system. We temporarily |
| 714 | # remove them to avoid interference from the machine where tests |
| 715 | # are being run. |
| 716 | monkeypatch.delenv("DASK_CONFIG", raising=False) |
| 717 | monkeypatch.delenv("DASK_ROOT_CONFIG", raising=False) |
| 718 | monkeypatch.setattr(site, "PREFIXES", []) |
| 719 | |
| 720 | expected = [ |
| 721 | "/etc/dask", |
| 722 | os.path.join(sys.prefix, "etc", "dask"), |
| 723 | os.path.join(os.path.expanduser("~"), ".config", "dask"), |
| 724 | ] |
| 725 | paths = _get_paths() |
| 726 | assert paths == expected |
| 727 | assert len(paths) == len(set(paths)) # No duplicate paths |
| 728 | |
| 729 | with monkeypatch.context() as m: |
| 730 | m.setenv("DASK_CONFIG", "foo-bar") |
| 731 | paths = _get_paths() |
| 732 | assert paths == expected + ["foo-bar"] |
| 733 | assert len(paths) == len(set(paths)) |
| 734 | |
| 735 | with monkeypatch.context() as m: |
| 736 | m.setenv("DASK_ROOT_CONFIG", "foo-bar") |
| 737 | paths = _get_paths() |
| 738 | assert paths == ["foo-bar"] + expected[1:] |
| 739 | assert len(paths) == len(set(paths)) |
| 740 | |
| 741 | with monkeypatch.context() as m: |
| 742 | prefix = os.path.join("include", "this", "path") |
| 743 | m.setattr(site, "PREFIXES", site.PREFIXES + [prefix]) |
| 744 | paths = _get_paths() |
| 745 | assert os.path.join(prefix, "etc", "dask") in paths |
| 746 | assert len(paths) == len(set(paths)) |
| 747 | |
| 748 | |
| 749 | def test_default_search_paths(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…