From 73b6d26ff32c4a06ef0bb6661b0d4166d32be69b Mon Sep 17 00:00:00 2001
From: Willem-Jan Vriend <wjvriend@astro.rug.nl>
Date: Wed, 12 Oct 2022 09:41:31 +0200
Subject: [PATCH] removed obsolete

---
 src/micado/test/functional/dark_test.py       | 49 -------------------
 src/micado/test/functional/detector_test.py   |  1 -
 src/micado/test/functional/detrend_test.py    |  1 -
 src/micado/test/functional/flat_test.py       |  1 -
 src/micado/test/functional/masterdark_test.py |  2 -
 src/micado/test/functional/masterflat_test.py |  1 -
 src/micado/test/functional/mdbobject_test.py  |  2 -
 src/micado/test/functional/science_test.py    |  2 -
 src/micado/test/functional/stack_test.py      |  1 -
 9 files changed, 60 deletions(-)

diff --git a/src/micado/test/functional/dark_test.py b/src/micado/test/functional/dark_test.py
index 18bdccb06..e96518927 100644
--- a/src/micado/test/functional/dark_test.py
+++ b/src/micado/test/functional/dark_test.py
@@ -107,7 +107,6 @@ def compare_raws(raw1: Raw, raw2: Raw):
 
 def test_dark():
     """Test creation of a Dark."""
-    Env["use_python_logging"] = True
     # Set the real dark current and create a DetectorArray.
     dark_real = 10000.0
 
@@ -144,7 +143,6 @@ def test_dark():
 
 def test_dark_multi():
     """Test creation of a Dark."""
-    Env["use_python_logging"] = True
     # Set the real dark current and create a DetectorArray.
     dark_real = 10000.0
     mydetectorarray = generate_detectorarray(dark=dark_real, size=32, n_det=2)
@@ -197,56 +195,9 @@ def test_dark_multi():
     remove_file_and_links(dark1.filename)
 
 
-@pytest.mark.xfail(
-    reason="TPL CLS is not supported anymore and should be replaced by DPR.* keyword logic."
-)
-@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test will fail on Windows")
-def test_unknown_template():
-    """Test an unknown template.
-
-    This should just be ignored with a warning.
-    """
-    # TODO: Fix this test on Windows.
-    Env["use_python_logging"] = True
-
-    # Generate an image with only 32 by 32 pixels.
-    dark1 = generate_dark(size=32)
-    dark1.save_fits()
-
-    # Update the header to refer to a non-existing template.
-    hdus = fits.open(os.path.realpath(dark1.filename), mode="update")
-    assert hdus[0].header["WISE TPL CLS"] == MicadoImgCalDark.name_eso()
-    hdus[0].header["WISE TPL CLS"] = "MCD_does_not_exist"
-    hdus.close()
-
-    # And try to reopen the file, should print
-    # Warning: cannot find class MCD_does_not_exist
-    dark2 = Dark(filename=dark1.filename)
-    assert dark1 == dark2
-
-    # Create a Dark without an extension. This is the ESO standard for files
-    # with only one layer.
-    hdus = fits.open(os.path.realpath(dark1.filename), mode="update")
-    hdus[0].header.update(hdus[1].header)
-    hdus[0].data = hdus[1].data
-    # Need to fix the output because the header order is wrong.
-    hdus.close(output_verify="fix")
-
-    # Try to read it.
-    dark3 = Dark(filename=dark1.filename)
-    # TODO: Ensure dark1 and dark3 are the same.
-    #   Not an pytest.xfail because the cleanup is not in a fixture yet.
-    with pytest.raises(AssertionError):
-        assert dark1 == dark3
-
-    # Cleanup.
-    remove_file_and_links(dark1.filename)
-
-
 @pytest.mark.skipif(sys.platform.startswith("win"), reason="Test will fail on Windows")
 def test_template():
     """Test reading a template from FITS."""
-    Env["use_python_logging"] = True
 
     dark_template = MicadoImgCalDark(det__dit=1)
 
diff --git a/src/micado/test/functional/detector_test.py b/src/micado/test/functional/detector_test.py
index 89baf6c8f..09b9d80b2 100644
--- a/src/micado/test/functional/detector_test.py
+++ b/src/micado/test/functional/detector_test.py
@@ -45,7 +45,6 @@ def generate_detectorarray(dark: float = 2.0, size: int = 32, n_det=1) -> Detect
 
 def test_extra_parameters():
     """Test whether there is an error when extra parameters are specified."""
-    Env["use_python_logging"] = True
 
     with pytest.raises(AttributeError):
         _ = Detector(
diff --git a/src/micado/test/functional/detrend_test.py b/src/micado/test/functional/detrend_test.py
index d278e1bd9..e05f2d2f0 100644
--- a/src/micado/test/functional/detrend_test.py
+++ b/src/micado/test/functional/detrend_test.py
@@ -28,7 +28,6 @@ from .masterdark_test import create_masterdark
 
 def test_processing():
     """Test processing of Detrend."""
-    Env["use_python_logging"] = True
     mymasterdark, dark_real, myraws_raw = create_masterdark()
 
     # TODO: Do not reuse the MasterDark as MasterFlat.
diff --git a/src/micado/test/functional/flat_test.py b/src/micado/test/functional/flat_test.py
index 731b72678..406dabb1c 100644
--- a/src/micado/test/functional/flat_test.py
+++ b/src/micado/test/functional/flat_test.py
@@ -78,7 +78,6 @@ def generate_flat(dark: float = 2.0, size: int = 32):
 
 def test_flat():
     """Test creation of a Flat."""
-    Env["use_python_logging"] = True
     dark = 0.0
     flat1 = generate_flat(dark=dark)
 
diff --git a/src/micado/test/functional/masterdark_test.py b/src/micado/test/functional/masterdark_test.py
index 77dd2ab51..cafc86255 100644
--- a/src/micado/test/functional/masterdark_test.py
+++ b/src/micado/test/functional/masterdark_test.py
@@ -143,7 +143,6 @@ def compare_pros(dataitem1: Img, dataitem2: Img):
 
 def test_processing():
     """Test creation of MasterDark."""
-    Env["use_python_logging"] = True
     mymasterdark, dark_real, mydarks_raw = create_masterdark()
 
     # Create image statistics.
@@ -188,7 +187,6 @@ def test_processing():
 
 def test_none_mobject_fits():
     """Test an '' reference in a FITS file."""
-    Env["use_python_logging"] = True
 
     masterdark1, _, mydarks_raw = create_masterdark(simple=True)
 
diff --git a/src/micado/test/functional/masterflat_test.py b/src/micado/test/functional/masterflat_test.py
index c59dae7b9..7db89718c 100644
--- a/src/micado/test/functional/masterflat_test.py
+++ b/src/micado/test/functional/masterflat_test.py
@@ -65,7 +65,6 @@ def create_masterflat(simple: bool = False):
 
 def test_processing():
     """Test creation of MasterFlat."""
-    Env["use_python_logging"] = True
     mymasterflat, myflats_raw, mydarks = create_masterflat()
 
     # Create image statistics.
diff --git a/src/micado/test/functional/mdbobject_test.py b/src/micado/test/functional/mdbobject_test.py
index 3641f255f..c2c34c55c 100644
--- a/src/micado/test/functional/mdbobject_test.py
+++ b/src/micado/test/functional/mdbobject_test.py
@@ -9,8 +9,6 @@ from micado.hardware.Detector import Detector
 
 def test_getraw():
     """Test getting raw dataproducts."""
-    Env["use_python_logging"] = True
-
     assert MasterDark.get_raw_attr_class() == ("darks", Dark)
     assert Dark.get_raw_class() == Dark
     assert Detector.get_raw_attr_class() == (None, None)
diff --git a/src/micado/test/functional/science_test.py b/src/micado/test/functional/science_test.py
index 1459c69d1..bd330a6ce 100644
--- a/src/micado/test/functional/science_test.py
+++ b/src/micado/test/functional/science_test.py
@@ -175,7 +175,6 @@ def get_science(size=32, dark_current=100):
 
 def test_science():
     """Test creation of a Raw Science image."""
-    Env["use_python_logging"] = True
 
     science1 = get_science()
     science1.make_simulation()
@@ -215,7 +214,6 @@ def test_science():
 
 def test_science_multi():
     """Test creation of a multi-extension raw image."""
-    Env["use_python_logging"] = True
     # Set the dark current and create a DetectorArray.
     dark_current = 100.0
     mydarkcurrent = DarkCurrent(value=dark_current)
diff --git a/src/micado/test/functional/stack_test.py b/src/micado/test/functional/stack_test.py
index a86aacdb1..b5659b12b 100644
--- a/src/micado/test/functional/stack_test.py
+++ b/src/micado/test/functional/stack_test.py
@@ -31,7 +31,6 @@ from micado.test.functional.science_test import get_filt_inst_ro, get_atmo_teles
 )
 def test_stack():
     """Test stacking of images."""
-    Env["use_python_logging"] = True
 
     scopesim.server.download_package("telescopes/ELT")
     scopesim.server.download_package("instruments/MICADO")
-- 
GitLab