Repository: dask/dask

Issue:
Test failures on windows with graphviz missing .bat files.
Today I started seeing failures in the tests like:

```python-traceback
cmd = ['dot.bat', '-Kdot', '-Tpng']
input = b'digraph {\n\tgraph [rankdir=BT]\n\t4770961679805687079 [label="" shape=box]\n\t-2718215776272399448 [label="" shape=...79 -> 1289659767108614192\n\t-1109490218808452559 [label="" shape=box]\n\t-2595565211807651805 [label="" shape=box]\n}'
capture_output = True, check = True, encoding = None, quiet = False
kwargs = {'stderr': -1, 'stdin': -1, 'stdout': -1}

    def run(cmd, input=None, capture_output=False, check=False, encoding=None,
            quiet=False, **kwargs):
        """Run the command described by cmd and return its (stdout, stderr) tuple."""
        log.debug('run %r', cmd)
    
        if input is not None:
            kwargs['stdin'] = subprocess.PIPE
            if encoding is not None:
                input = input.encode(encoding)
    
        if capture_output:
            kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE
    
        try:
            proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
        except OSError as e:
            if e.errno == errno.ENOENT:
>               raise ExecutableNotFound(cmd)
E               graphviz.backend.ExecutableNotFound: failed to execute ['dot.bat', '-Kdot', '-Tpng'], make sure the Graphviz executables are on your systems' PATH

C:\Miniconda3\envs\test-environment\lib\site-packages\graphviz\backend.py:169: ExecutableNotFound
```

for example: https://github.com/dask/dask/pull/7230/checks?check_run_id=1911913930

I suspsect that something is wrong with the conda-forge package: graphviz 2.46.1 h93c640b_0 which was released today. 

I am going to pin graphviz to an older version in the tests 

Discussion:

Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5b6e041b8..e434c280e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,6 +29,13 @@ jobs:
           activate-environment: test-environment
           auto-activate-base: false
 
+      - name: Hack around https://github.com/dask/dask/issues/7189
+        shell: bash -l {0}
+        if: ${{ matrix.os == 'macos-latest' && matrix.python-version == '3.8' }}
+        run: |
+          conda uninstall --force numpy
+          python -m pip install --no-deps numpy==1.20
+
       - name: Install
         shell: bash -l {0}
         run: source continuous_integration/scripts/install.sh
diff --git a/continuous_integration/environment-3.6.yaml b/continuous_integration/environment-3.6.yaml
index dda58d089..9f55641fa 100644
--- a/continuous_integration/environment-3.6.yaml
+++ b/continuous_integration/environment-3.6.yaml
@@ -37,7 +37,7 @@ dependencies:
   - crick
   - cytoolz
   - distributed
-  - graphviz=2.38.0  # pinned to avoid https://github.com/dask/dask/issues/7231
+  - graphviz
   - ipython
   - lz4
   - numba
diff --git a/continuous_integration/environment-3.7.yaml b/continuous_integration/environment-3.7.yaml
index 1618b4815..404fb2d3b 100644
--- a/continuous_integration/environment-3.7.yaml
+++ b/continuous_integration/environment-3.7.yaml
@@ -36,7 +36,7 @@ dependencies:
   - crick
   - cytoolz
   - distributed
-  - graphviz=2.38.0  # pinned to avoid https://github.com/dask/dask/issues/7231
+  - graphviz
   - ipython
   - lz4
   - numba
diff --git a/continuous_integration/environment-3.8-dev.yaml b/continuous_integration/environment-3.8-dev.yaml
index 559b80f66..fdf952944 100644
--- a/continuous_integration/environment-3.8-dev.yaml
+++ b/continuous_integration/environment-3.8-dev.yaml
@@ -36,7 +36,7 @@ dependencies:
   - crick
   - cytoolz
   - distributed
-  - graphviz=2.38.0  # pinned to avoid https://github.com/dask/dask/issues/7231
+  - graphviz
   - ipython
   - lz4
   - numba>=0.49
diff --git a/continuous_integration/environment-3.8.yaml b/continuous_integration/environment-3.8.yaml
index 386e413ae..86c034ed7 100644
--- a/continuous_integration/environment-3.8.yaml
+++ b/continuous_integration/environment-3.8.yaml
@@ -36,7 +36,7 @@ dependencies:
   - crick
   - cytoolz
   - distributed
-  - graphviz=2.38.0  # pinned to avoid https://github.com/dask/dask/issues/7231
+  - graphviz
   - ipython
   - lz4
   - numba
diff --git a/dask/array/overlap.py b/dask/array/overlap.py
index 9170ec909..3bd61cbf2 100644
--- a/dask/array/overlap.py
+++ b/dask/array/overlap.py
@@ -817,9 +817,7 @@ def coerce_depth(ndim, depth):
     if isinstance(depth, tuple):
         depth = dict(zip(range(ndim), depth))
     if isinstance(depth, dict):
-        for i in range(ndim):
-            if i not in depth:
-                depth[i] = 0
+        depth = {ax: depth.get(ax, default) for ax in range(ndim)}
     return coerce_depth_type(ndim, depth)
 
 
@@ -841,7 +839,5 @@ def coerce_boundary(ndim, boundary):
     if isinstance(boundary, tuple):
         boundary = dict(zip(range(ndim), boundary))
     if isinstance(boundary, dict):
-        for i in range(ndim):
-            if i not in boundary:
-                boundary[i] = default
+        boundary = {ax: boundary.get(ax, default) for ax in range(ndim)}
     return boundary


Test patch:
diff --git a/dask/array/tests/test_overlap.py b/dask/array/tests/test_overlap.py
index 712fbe844..b8fa48851 100644
--- a/dask/array/tests/test_overlap.py
+++ b/dask/array/tests/test_overlap.py
@@ -302,6 +302,10 @@ def test_map_overlap():
     assert all([(type(s) is int) for s in y.shape])
     assert_eq(y, np.arange(10) + 5 + 2 + 2)
 
+    x = da.ones((10, 10), chunks=(3, 4))
+    z = x.map_overlap(lambda x: x, depth={1: 5})
+    assert z.chunks[0] == x.chunks[0]  # don't rechunk the first dimension
+
     x = np.arange(16).reshape((4, 4))
     d = da.from_array(x, chunks=(2, 2))
     exp1 = d.map_overlap(lambda x: x + x.size, depth=1, dtype=d.dtype)