From ce70d96197023274b4a06a932890d663a0cf1b9f Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Wed, 3 Aug 2022 14:24:58 +0200
Subject: [PATCH] apply black on the whole directory

---
 tests/test_reference_runs/callab_tests.py     | 212 +++++++-----------
 tests/test_reference_runs/conftest.py         |  28 ++-
 .../test_pre_deployment.py                    | 102 +++++----
 3 files changed, 159 insertions(+), 183 deletions(-)

diff --git a/tests/test_reference_runs/callab_tests.py b/tests/test_reference_runs/callab_tests.py
index 97ab9b190..f6825dbdc 100644
--- a/tests/test_reference_runs/callab_tests.py
+++ b/tests/test_reference_runs/callab_tests.py
@@ -1,10 +1,8 @@
 automated_test_config = {
-    "SPB_DET_AGIPD1M-1-CORRECT-FIXED":
-    {
+    "SPB_DET_AGIPD1M-1-CORRECT-FIXED": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
             "run": "95",
@@ -13,14 +11,12 @@ automated_test_config = {
             "slurm-mem": "750",
             "ctrl-source-template": "{}/MDL/FPGA_COMP",
         },
-        "reference-folder": "{}/{}/{}"
+        "reference-folder": "{}/{}/{}",
     },
-    "SPB_DET_AGIPD1M-1-DARK-FIXED":
-    {
+    "SPB_DET_AGIPD1M-1-DARK-FIXED": {
         "det_type": "AGIPD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
             "run-high": "91",
@@ -33,11 +29,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "SPB_DET_AGIPD1M-1-CORRECT-ADAPTIVE":{
+    "SPB_DET_AGIPD1M-1-CORRECT-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
             "run": "262",
@@ -48,12 +43,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "SPB_DET_AGIPD1M-1-DARK-ADAPTIVE":
-    {
+    "SPB_DET_AGIPD1M-1-DARK-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
             "run-high": "216",
@@ -66,13 +59,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-
-    "MID_DET_AGIPD1M-1-CORRECT-ADAPTIVE":
-    {
+    "MID_DET_AGIPD1M-1-CORRECT-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
             "run": "21",
@@ -83,12 +73,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "MID_DET_AGIPD1M-1-DARK-ADAPTIVE":
-    {
+    "MID_DET_AGIPD1M-1-DARK-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
             "run-high": "4",
@@ -101,12 +89,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_DET_AGIPD500K2G-CORRECT-ADAPTIVE":
-    {
+    "HED_DET_AGIPD500K2G-CORRECT-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202131/p900228/raw",
             "run": "29",
@@ -117,11 +103,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_DET_AGIPD500K2G-DARK-ADAPTIVE":{
+    "HED_DET_AGIPD500K2G-DARK-ADAPTIVE": {
         "det_type": "AGIPD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202131/p900228/raw",
             "run-high": "25",
@@ -134,12 +119,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_CM":
-    {
+    "MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_CM": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
             "run": "21",
@@ -152,31 +135,26 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_NOCM":
-    {
+    "MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_NOCM": {
         "det_type": "AGIPD",
         "cal_type": "CORRECT",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
             "run": "21",
-                "max-pulses": [0, 160, 2],
-
+            "max-pulses": [0, 160, 2],
             "no-common-mode": True,
             "karabo-id-control": "MID_EXP_AGIPD1M1",
             "karabo-id": "MID_DET_AGIPD1M-1",
             "slurm-mem": "750",
             "ctrl-source-template": "{}/MDL/FPGA_COMP",
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF500K-DARK-SINGLE":
-    {
+    "FXE_XAD_JF500K-DARK-SINGLE": {
         "det_type": "JUNGFRAU",
         "cal_type": "DARK",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
             "run-high": "47",
@@ -185,30 +163,26 @@ automated_test_config = {
             "karabo-id-control": "",
             "karabo-id": "FXE_XAD_JF500K",
             "karabo-da": "JNGFR03",
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF500K-CORRECT-SINGLE":
-    {
+    "FXE_XAD_JF500K-CORRECT-SINGLE": {
         "det_type": "JUNGFRAU",
         "cal_type": "CORRECT",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
             "run": "52",
             "karabo-id-control": "",
             "karabo-id": "FXE_XAD_JF500K",
             "karabo-da": "JNGFR03",
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF1M-DARK-BURST":
-    {
+    "FXE_XAD_JF1M-DARK-BURST": {
         "det_type": "JUNGFRAU",
         "cal_type": "DARK",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw/",
             "run-high": "108",
@@ -217,15 +191,13 @@ automated_test_config = {
             "karabo-id-control": "",
             "karabo-id": "FXE_XAD_JF1M",
             "karabo-da": ["JNGFR01", "JNGFR02"],
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF1M-CORRECT-BURST":
-    {
+    "FXE_XAD_JF1M-CORRECT-BURST": {
         "det_type": "JUNGFRAU",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw",
             "run": "106",
@@ -235,12 +207,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF1M-DARK-SINGLE":
-    {
+    "FXE_XAD_JF1M-DARK-SINGLE": {
         "det_type": "JUNGFRAU",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
             "run-high": "47",
@@ -252,45 +222,45 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_XAD_JF1M-CORRECT-SINGLE":
-    {
+    "FXE_XAD_JF1M-CORRECT-SINGLE": {
         "det_type": "JUNGFRAU",
         "cal_type": "CORRECT",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
             "run": "52",
             "karabo-id-control": "",
             "karabo-id": "FXE_XAD_JF1M",
             "karabo-da": ["JNGFR01", "JNGFR02"],
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "SPB_IRDA_JF4M-CORRECT-SINGLE":
-    {
+    "SPB_IRDA_JF4M-CORRECT-SINGLE": {
         "det_type": "JUNGFRAU",
         "cal_type": "CORRECT",
-        "config":
-                {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202130/p900204/raw",
             "run": "91",
             "karabo-id-control": "",
             "karabo-id": "SPB_IRDA_JF4M",
             "karabo-da": [
-                "JNGFR01", "JNGFR02", "JNGFR03", "JNGFR04",
-                "JNGFR05", "JNGFR06", "JNGFR07", "JNGFR08"
+                "JNGFR01",
+                "JNGFR02",
+                "JNGFR03",
+                "JNGFR04",
+                "JNGFR05",
+                "JNGFR06",
+                "JNGFR07",
+                "JNGFR08",
             ],
-                },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "SPB_IRDA_JF4M-DARK-ADAPTIVE":
-    {
+    "SPB_IRDA_JF4M-DARK-ADAPTIVE": {
         "det_type": "JUNGFRAU",
         "cal_type": "DARK",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SPB/202130/p900204/raw",
             "run-high": "88",
@@ -299,32 +269,34 @@ automated_test_config = {
             "karabo-id-control": "",
             "karabo-id": "SPB_IRDA_JF4M",
             "karabo-da": [
-                "JNGFR01", "JNGFR02", "JNGFR03", "JNGFR04",
-                "JNGFR05", "JNGFR06", "JNGFR07", "JNGFR08"
+                "JNGFR01",
+                "JNGFR02",
+                "JNGFR03",
+                "JNGFR04",
+                "JNGFR05",
+                "JNGFR06",
+                "JNGFR07",
+                "JNGFR08",
             ],
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_IA1_JF500K1-CORRECT-ADAPTIVE":
-    {
+    "HED_IA1_JF500K1-CORRECT-ADAPTIVE": {
         "det_type": "JUNGFRAU",
         "cal_type": "CORRECT",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
             "run": "230",
             "karabo-id": "HED_IA1_JF500K1",
             "karabo-da": "JNGFR01",
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_IA1_JF500K1-DARK-ADAPTIVE":
-    {
+    "HED_IA1_JF500K1-DARK-ADAPTIVE": {
         "det_type": "JUNGFRAU",
         "cal_type": "DARK",
-        "config":
-            {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
             "run-high": "219",
@@ -332,15 +304,13 @@ automated_test_config = {
             "run-low": "221",
             "karabo-id": "HED_IA1_JF500K1",
             "karabo-da": "JNGFR01",
-            },
+        },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_IA1_EPX100-1-CORRECT":
-    {
+    "HED_IA1_EPX100-1-CORRECT": {
         "det_type": "EPIX100",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
             "run": "230",
@@ -349,12 +319,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "HED_IA1_EPX100-1-DARK":
-    {
+    "HED_IA1_EPX100-1-DARK": {
         "det_type": "EPIX100",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
             "run": "219",
@@ -363,26 +331,22 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "SQS_NQS_PNCCD1MP-CORRECT":
-    {
+    "SQS_NQS_PNCCD1MP-CORRECT": {
         "det_type": "PNCCD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SQS/202031/p900166/raw",
             "run": "347",
             "karabo-id": "SQS_NQS_PNCCD1MP",
             "karabo-da": "PNCCD01",
         },
-        "reference-folder": "{}/{}/{}"
+        "reference-folder": "{}/{}/{}",
     },
-    "SQS_NQS_PNCCD1MP-DARK":
-    {
+    "SQS_NQS_PNCCD1MP-DARK": {
         "det_type": "PNCCD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SQS/202031/p900166/raw",
             "run": "345",
@@ -391,12 +355,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_DET_LPD1M-1-DARK":
-    {
+    "FXE_DET_LPD1M-1-DARK": {
         "det_type": "LPD",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw",
             "run-high": "145",
@@ -406,12 +368,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "FXE_DET_LPD1M-1-CORRECT":
-    {
+    "FXE_DET_LPD1M-1-CORRECT": {
         "det_type": "LPD",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw",
             "run": "145",
@@ -419,12 +379,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "SCS_DET_DSSC1M-1-DARK":
-    {
+    "SCS_DET_DSSC1M-1-DARK": {
         "det_type": "DSSC",
         "cal_type": "DARK",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SCS/202122/p002937/raw",
             "run": "1723",
@@ -433,12 +391,10 @@ automated_test_config = {
         },
         "reference-folder": "{}/{}/{}",
     },
-    "SCS_DET_DSSC1M-1-CORRECT":
-    {
+    "SCS_DET_DSSC1M-1-CORRECT": {
         "det_type": "DSSC",
         "cal_type": "CORRECT",
-        "config":
-        {
+        "config": {
             "out-folder": "{}/{}/{}",
             "in-folder": "/gpfs/exfel/exp/SCS/202122/p002937/raw",
             "run": "1723",
diff --git a/tests/test_reference_runs/conftest.py b/tests/test_reference_runs/conftest.py
index 781705574..d132e519c 100644
--- a/tests/test_reference_runs/conftest.py
+++ b/tests/test_reference_runs/conftest.py
@@ -14,14 +14,15 @@ def pytest_addoption(parser):
     #     detectors_choices += [k, k.upper()]
     parser.addoption(
         "--detectors",
-        default=['all'],
-        nargs='+',    )
+        default=["all"],
+        nargs="+",
+    )
 
     parser.addoption(
         "--calibration",
         type=str,
-        choices=['correct', 'dark', 'all'],
-        default='all',
+        choices=["correct", "dark", "all"],
+        default="all",
     )
 
     parser.addoption(
@@ -47,18 +48,22 @@ def pytest_addoption(parser):
         type=str,
     )
 
+
 @pytest.fixture
 def release_test_config(request):
     detectors = request.config.getoption("--detectors")
     calibration = request.config.getoption("--calibration")
-    skip_numerical_validation = request.config.getoption(
-        "--no-numerical-validation")
+    skip_numerical_validation = request.config.getoption("--no-numerical-validation")
     picked_test = request.config.getoption("--picked-test")
     reference_folder = request.config.getoption("--reference-folder")
     out_folder = request.config.getoption("--out-folder")
     return (
-        detectors, calibration, picked_test,
-        skip_numerical_validation, reference_folder, out_folder
+        detectors,
+        calibration,
+        picked_test,
+        skip_numerical_validation,
+        reference_folder,
+        out_folder,
     )
 
 
@@ -70,8 +75,7 @@ def pytest_configure(config):
 
 
 def pytest_runtest_setup(item):
-    if (
-        list(item.iter_markers(name="manual_run")) and
-        not item.config.getoption("--release-test")
+    if list(item.iter_markers(name="manual_run")) and not item.config.getoption(
+        "--release-test"
     ):
-        pytest.skip("Test initialized manually")
\ No newline at end of file
+        pytest.skip("Test initialized manually")
diff --git a/tests/test_reference_runs/test_pre_deployment.py b/tests/test_reference_runs/test_pre_deployment.py
index aaeaf7dff..0bb880184 100644
--- a/tests/test_reference_runs/test_pre_deployment.py
+++ b/tests/test_reference_runs/test_pre_deployment.py
@@ -21,7 +21,7 @@ from .callab_tests import automated_test_config
 
 def file_md5(
     tested_file: str,
-    block_size: int = 2**20,
+    block_size: int = 2 ** 20,
 ) -> bytes:
     """Generating MD5 checksum for a file.
 
@@ -42,8 +42,7 @@ def file_md5(
 
 
 def validate_h5files(
-    f: pathlib.PosixPath,
-    ref_folder: pathlib.PosixPath
+    f: pathlib.PosixPath, ref_folder: pathlib.PosixPath
 ) -> Tuple[bool, pathlib.PosixPath]:
     """Validate the h5files based on the generated MD5 checksum.
 
@@ -62,7 +61,7 @@ def validate_h5files(
 def validate_constant_file(
     ref_folder: pathlib.PosixPath,
     out_folder: pathlib.PosixPath,
-    test_file: pathlib.PosixPath
+    test_file: pathlib.PosixPath,
 ) -> Tuple[bool, bool, pathlib.PosixPath]:
     """Validate the constants files by validating the metadata
     stored in the h5files, e.g. conditions and db_modules. This is
@@ -90,16 +89,20 @@ def validate_constant_file(
         prefix="cal_",
         delete=True,
     )
-    hp1 = h5py.File(out_tf.name, 'w', driver='core', backing_store=True)
-    hp2 = h5py.File(ref_tf.name, 'w', driver='core', backing_store=True)
+    hp1 = h5py.File(out_tf.name, "w", driver="core", backing_store=True)
+    hp2 = h5py.File(ref_tf.name, "w", driver="core", backing_store=True)
     # Copy RAW non-calibrated sources.
-    with h5py.File(test_file, 'r') as sfile:
+    with h5py.File(test_file, "r") as sfile:
         h5_copy_except.h5_copy_except_paths(
-            sfile, hp1, ["report", "creation_time"],
+            sfile,
+            hp1,
+            ["report", "creation_time"],
         )
-    with h5py.File(ref_folder / test_file.name, 'r') as sfile:
+    with h5py.File(ref_folder / test_file.name, "r") as sfile:
         h5_copy_except.h5_copy_except_paths(
-            sfile, hp2, ["report", "creation_time"],
+            sfile,
+            hp2,
+            ["report", "creation_time"],
         )
     hp1.close()
     hp2.close()
@@ -110,23 +113,19 @@ def validate_constant_file(
     return result, test_file
 
 
-def parse_config(
-    cmd: List[str],
-    config: Dict[str, Any],
-    out_folder: str
-) -> List[str]:
+def parse_config(cmd: List[str], config: Dict[str, Any], out_folder: str) -> List[str]:
     """Convert a dictionary to a list of arguments.
 
-       Values that are not strings will be cast.
-       Lists will be converted to several strings following their `--key`
-       flag.
-       Booleans will be converted to a `--key` flag, where `key` is the
-       dictionary key.
+    Values that are not strings will be cast.
+    Lists will be converted to several strings following their `--key`
+    flag.
+    Booleans will be converted to a `--key` flag, where `key` is the
+    dictionary key.
     """
 
     for key, value in config.items():
-        if ' ' in key or (isinstance(value, str) and ' ' in value):
-            raise ValueError('Spaces are not allowed', key, value)
+        if " " in key or (isinstance(value, str) and " " in value):
+            raise ValueError("Spaces are not allowed", key, value)
 
         if isinstance(value, list):
             cmd.append(f"--{key}")
@@ -150,10 +149,9 @@ def parse_config(
     ids=list(automated_test_config.keys()),
 )
 def test_xfel_calibrate(
-    test_key: str, val_dict: dict,
-    release_test_config: Tuple[bool, bool, bool, bool]
+    test_key: str, val_dict: dict, release_test_config: Tuple[bool, bool, bool, bool]
 ):
-    """ Test xfel calibrate detectors and calibrations written
+    """Test xfel calibrate detectors and calibrations written
     in the given callab_test YAML file.
     Args:
         test_key : Key for the xfel-calibrate test.
@@ -163,8 +161,12 @@ def test_xfel_calibrate(
     """
 
     (
-        detectors, calibration, picked_test,
-        skip_numerical_validation, reference_dir_base, out_dir_base,
+        detectors,
+        calibration,
+        picked_test,
+        skip_numerical_validation,
+        reference_dir_base,
+        out_dir_base,
     ) = release_test_config
 
     cal_type = val_dict["cal_type"]
@@ -172,10 +174,9 @@ def test_xfel_calibrate(
 
     if picked_test is None:
         # Skip non-selected detectors
-        if (
-            detectors != ["all"] and
-            det_type.lower() not in [d.lower() for d in detectors]
-        ):
+        if detectors != ["all"] and det_type.lower() not in [
+            d.lower() for d in detectors
+        ]:
             pytest.skip()
 
         # Skip non-selected calibration
@@ -190,12 +191,16 @@ def test_xfel_calibrate(
     report_name = f"{test_key}_{datetime.now().strftime('%y%m%d_%H%M%S')}"
     cal_conf["report-to"] = report_name
 
-    out_folder = pathlib.Path(cal_conf["out-folder"].format(
-        out_dir_base, cal_conf["karabo-id"], test_key))
+    out_folder = pathlib.Path(
+        cal_conf["out-folder"].format(out_dir_base, cal_conf["karabo-id"], test_key)
+    )
     cmd = parse_config(cmd, cal_conf, out_folder)
 
-    reference_folder = pathlib.Path(val_dict["reference-folder"].format(
-        reference_dir_base, cal_conf["karabo-id"], test_key))
+    reference_folder = pathlib.Path(
+        val_dict["reference-folder"].format(
+            reference_dir_base, cal_conf["karabo-id"], test_key
+        )
+    )
 
     cmd += ["--slurm-name", test_key]
     f = io.StringIO()
@@ -219,15 +224,19 @@ def test_xfel_calibrate(
         res = run(cmd, stdout=PIPE)
         states = res.stdout.decode().split("\n")[2:-1]
 
-        if not any(s.strip() in [
-            "COMPLETING", "RUNNING", "CONFIGURING", "PENDING"] for s in states):  # noqa
+        if not any(
+            s.strip() in ["COMPLETING", "RUNNING", "CONFIGURING", "PENDING"]
+            for s in states
+        ):  # noqa
             slurm_watcher = False
         else:
             time.sleep(0.5)
 
     # 1st check that all jobs were COMPLETED without errors.
     states = res.stdout.decode().split("\n")[2:-1]
-    assert all(s.strip() == "COMPLETED" for s in states), f"{test_key} failure, calibration jobs were not completed. {jobids}: {states}"  # noqa
+    assert all(
+        s.strip() == "COMPLETED" for s in states
+    ), f"{test_key} failure, calibration jobs were not completed. {jobids}: {states}"  # noqa
     print(f"{test_key}'s jobs were COMPLETED")
     time.sleep(1.0)
 
@@ -238,7 +247,9 @@ def test_xfel_calibrate(
     # 3rd Check number of produced h5 files.
     h5files = list(out_folder.glob("*.h5"))
     expected_h5files = list(reference_folder.glob("*.h5"))
-    assert len(h5files) == len(expected_h5files), f"{test_key} failure, number of files are not as expected."  # noqa
+    assert len(h5files) == len(
+        expected_h5files
+    ), f"{test_key} failure, number of files are not as expected."  # noqa
     print(f"{test_key}'s calibration h5files numbers are as expected.")
 
     # Stop tests at this point, if desired.
@@ -249,15 +260,20 @@ def test_xfel_calibrate(
     # 4th check that h5files are exactly the same as the reference h5files.
     if cal_type.lower() == "correct":
         with multiprocessing.Pool() as pool:
-            result = pool.starmap(validate_h5files, zip(
-                h5files, len(h5files)*[reference_folder]))
+            result = pool.starmap(
+                validate_h5files, zip(h5files, len(h5files) * [reference_folder])
+            )
     else:  # "dark"
-        validate_files = partial(validate_constant_file, reference_folder, out_folder)  # noqa
+        validate_files = partial(
+            validate_constant_file, reference_folder, out_folder
+        )  # noqa
         with multiprocessing.Pool() as pool:
             result = pool.map(validate_files, h5files)
 
     for valid, file in result:
         if not valid:
             non_valid_files.append(file)
-    assert len(non_valid_files) == 0, f"{test_key} failure, while validating metadata for {non_valid_files}"  # noqa
+    assert (
+        len(non_valid_files) == 0
+    ), f"{test_key} failure, while validating metadata for {non_valid_files}"  # noqa
     print(f"{test_key}'s calibration h5files are validated successfully.")
-- 
GitLab