Author: Diane Trout <diane@ghic.org>
Description: I was manually slisting tests that needed to be but that
 led to two different confusing lists in the debian/rules and the
 autopkgtests because many of these tests would run after dask is
 installed, but can't run while we're still buildling the package.  As
 an experiment I wondered if adding a mark might make this list
 clearer and easier to maintain.
Forwarded: not-needed

--- a/distributed/cli/tests/test_dask_scheduler.py
+++ b/distributed/cli/tests/test_dask_scheduler.py
@@ -25,6 +25,7 @@
 import distributed.cli.dask_scheduler
 
 
+@pytest.mark.isinstalled
 def test_defaults(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as proc:
 
@@ -42,6 +43,7 @@
         response = requests.get("http://127.0.0.1:9786/info.json")
 
 
+@pytest.mark.isinstalled
 def test_hostport(loop):
     with popen(["dask-scheduler", "--no-dashboard", "--host", "127.0.0.1:8978"]):
 
@@ -54,6 +56,7 @@
             c.sync(f)
 
 
+@pytest.mark.isinstalled
 def test_no_dashboard(loop):
     pytest.importorskip("bokeh")
     with popen(["dask-scheduler", "--no-dashboard"]) as proc:
@@ -62,6 +65,7 @@
             assert response.status_code == 404
 
 
+@pytest.mark.isinstalled
 def test_dashboard(loop):
     pytest.importorskip("bokeh")
 
@@ -96,6 +100,7 @@
         requests.get("http://127.0.0.1:%d/status/" % dashboard_port)
 
 
+@pytest.mark.isinstalled
 def test_dashboard_non_standard_ports(loop):
     pytest.importorskip("bokeh")
 
@@ -121,6 +126,7 @@
 @pytest.mark.skipif(
     not sys.platform.startswith("linux"), reason="Need 127.0.0.2 to mean localhost"
 )
+@pytest.mark.isinstalled
 def test_dashboard_whitelist(loop):
     pytest.importorskip("bokeh")
     with pytest.raises(Exception):
@@ -143,6 +149,7 @@
                 assert time() < start + 20
 
 
+@pytest.mark.isinstalled
 def test_multiple_workers(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as s:
         with popen(["dask-worker", "localhost:8786", "--no-dashboard"]) as a:
@@ -154,6 +161,7 @@
                         assert time() < start + 10
 
 
+@pytest.mark.isinstalled
 def test_interface(loop):
     psutil = pytest.importorskip("psutil")
     if_names = sorted(psutil.net_if_addrs())
@@ -185,6 +193,7 @@
                 assert all("127.0.0.1" == d["host"] for d in info["workers"].values())
 
 
+@pytest.mark.isinstalled
 @pytest.mark.skipif(
     sys.version_info < (3, 7), reason="Intermittent failure on old Python version"
 )
@@ -221,6 +230,7 @@
                 check_pidfile(worker, w)
 
 
+@pytest.mark.isinstalled
 def test_scheduler_port_zero(loop):
     with tmpfile() as fn:
         with popen(
@@ -231,6 +241,7 @@
                 assert c.scheduler.port != 8786
 
 
+@pytest.mark.isinstalled
 def test_dashboard_port_zero(loop):
     pytest.importorskip("bokeh")
     with tmpfile() as fn:
@@ -256,6 +267,7 @@
 """
 
 
+@pytest.mark.isinstalled
 def test_preload_file(loop):
     def check_scheduler():
         import scheduler_info
@@ -275,6 +287,7 @@
         shutil.rmtree(tmpdir)
 
 
+@pytest.mark.isinstalled
 def test_preload_module(loop):
     def check_scheduler():
         import scheduler_info
@@ -308,6 +321,7 @@
         shutil.rmtree(tmpdir)
 
 
+@pytest.mark.isinstalled
 def test_preload_remote_module(loop, tmp_path):
     with open(tmp_path / "scheduler_info.py", "w") as f:
         f.write(PRELOAD_TEXT)
@@ -378,6 +392,7 @@
         shutil.rmtree(tmpdir)
 
 
+@pytest.mark.isinstalled
 def test_preload_command_default(loop):
     def check_passthrough():
         import passthrough_info
@@ -421,6 +436,7 @@
     assert 1 < stop - start < 10
 
 
+@pytest.mark.isinstalled
 def test_multiple_workers(loop):
     text = """
 def dask_setup(worker):
--- a/distributed/cli/tests/test_dask_worker.py
+++ b/distributed/cli/tests/test_dask_worker.py
@@ -19,6 +19,7 @@
 from distributed.utils_test import loop, cleanup  # noqa: F401
 
 
+@pytest.mark.isinstalled
 def test_nanny_worker_ports(loop):
     with popen(["dask-scheduler", "--port", "9359", "--no-dashboard"]) as sched:
         with popen(
@@ -49,6 +50,7 @@
                 )
 
 
+@pytest.mark.isinstalled
 def test_nanny_worker_port_range(loop):
     with popen(["dask-scheduler", "--port", "9359", "--no-dashboard"]) as sched:
         nprocs = 3
@@ -87,6 +89,7 @@
                 assert set(nanny_ports.values()) == expected_nanny_ports
 
 
+@pytest.mark.isinstalled
 def test_nanny_worker_port_range_too_many_workers_raises(loop):
     with popen(["dask-scheduler", "--port", "9359", "--no-dashboard"]) as sched:
         with popen(
@@ -109,6 +112,7 @@
             )
 
 
+@pytest.mark.isinstalled
 def test_memory_limit(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
         with popen(
@@ -129,6 +133,7 @@
                 assert d["memory_limit"] == 2e9
 
 
+@pytest.mark.isinstalled
 def test_no_nanny(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
         with popen(
@@ -137,6 +142,7 @@
             assert any(b"Registered" in worker.stderr.readline() for i in range(15))
 
 
+@pytest.mark.isinstalled
 @pytest.mark.slow
 @pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"])
 def test_no_reconnect(nanny, loop):
@@ -159,6 +165,7 @@
             assert time() < start + 10
 
 
+@pytest.mark.isinstalled
 def test_resources(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
         with popen(
@@ -178,6 +185,7 @@
                 assert worker["resources"] == {"A": 1, "B": 2, "C": 3}
 
 
+@pytest.mark.isinstalled
 @pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"])
 def test_local_directory(loop, nanny):
     with tmpfile() as fn:
@@ -202,6 +210,7 @@
                     assert worker["local_directory"].startswith(fn)
 
 
+@pytest.mark.isinstalled
 @pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"])
 def test_scheduler_file(loop, nanny):
     with tmpfile() as fn:
@@ -218,6 +227,7 @@
                         assert time() < start + 10
 
 
+@pytest.mark.isinstalled
 def test_scheduler_address_env(loop, monkeypatch):
     monkeypatch.setenv("DASK_SCHEDULER_ADDRESS", "tcp://127.0.0.1:8786")
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
@@ -240,6 +250,7 @@
             )
 
 
+@pytest.mark.isinstalled
 def test_nprocs_negative(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
         with popen(["dask-worker", "127.0.0.1:8786", "--nprocs=-1"]) as worker:
@@ -255,6 +266,7 @@
                 c.wait_for_workers(procs, timeout="10 seconds")
 
 
+@pytest.mark.isinstalled
 def test_nprocs_expands_name(loop):
     with popen(["dask-scheduler", "--no-dashboard"]) as sched:
         with popen(
@@ -274,6 +286,7 @@
                     assert len(set(names)) == 4
 
 
+@pytest.mark.isinstalled
 @pytest.mark.skipif(
     not sys.platform.startswith("linux"), reason="Need 127.0.0.2 to mean localhost"
 )
@@ -310,6 +323,7 @@
                 assert client.run(func) == {"tcp://127.0.0.2:39837": listen_address}
 
 
+@pytest.mark.isinstalled
 @pytest.mark.skipif(
     not sys.platform.startswith("linux"), reason="Need 127.0.0.2 to mean localhost"
 )
@@ -335,6 +349,7 @@
                 assert all(host in v for v in listen_addresses.values())
 
 
+@pytest.mark.isinstalled
 def test_dashboard_non_standard_ports(loop):
     pytest.importorskip("bokeh")
     try:
@@ -409,6 +424,7 @@
             pass
 
 
+@pytest.mark.isinstalled
 @pytest.mark.asyncio
 async def test_integer_names(cleanup):
     async with Scheduler(port=0) as s:
@@ -419,6 +435,7 @@
             assert ws.name == 123
 
 
+@pytest.mark.isinstalled
 @pytest.mark.asyncio
 @pytest.mark.parametrize("nanny", ["--nanny", "--no-nanny"])
 async def test_worker_class(cleanup, tmp_path, nanny):
