Repository: spacetelescope/exovetter (language: python)

Issue:
TST: Handle UserWarning in dev job
A follow up of #50. Blocked by lightkurve/lightkurve#988 .


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml
index 65e1bac..29908a0 100644
--- a/.github/workflows/ci_workflows.yml
+++ b/.github/workflows/ci_workflows.yml
@@ -74,6 +74,7 @@ jobs:
         sudo apt-get install libxml2-utils
         python -m pip install --upgrade pip setuptools
         python -m pip install git+https://github.com/astropy/astropy.git@master#egg=astropy
+        python -m pip install git+https://github.com/lightkurve/lightkurve.git@main#egg=lightkurve
         python -m pip install -e .[test,all]
     - name: Test with dev deps
       run: pytest --remote-data
diff --git a/setup.cfg b/setup.cfg
index 403e178..6fc7671 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -25,7 +25,7 @@ install_requires =
 all =
     matplotlib
     scikit-learn
-    lightkurve
+    lightkurve>=2
     lpproj
 test =
     pytest-cov


Test patch:
diff --git a/conftest.py b/conftest.py
index 18bb9f1..7895580 100644
--- a/conftest.py
+++ b/conftest.py
@@ -16,9 +16,11 @@
 
 
 PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
+PYTEST_HEADER_MODULES['scikit-learn'] = 'sklearn'
+PYTEST_HEADER_MODULES['lightkurve'] = 'lightkurve'
+PYTEST_HEADER_MODULES['lpproj'] = 'lpproj'
 
 # We can add these back to test header if they become a test dependency later.
-PYTEST_HEADER_MODULES.pop('Matplotlib', None)
 PYTEST_HEADER_MODULES.pop('h5py', None)
 PYTEST_HEADER_MODULES.pop('Pandas', None)
 
diff --git a/tests/test_lpp.py b/tests/test_lpp.py
index 11e0888..3b99f36 100644
--- a/tests/test_lpp.py
+++ b/tests/test_lpp.py
@@ -1,7 +1,7 @@
 """Test LPP functionalities."""
 import pytest
 from astropy import units as u
-from lightkurve import search_lightcurvefile
+from lightkurve import search_lightcurve
 from numpy.testing import assert_allclose
 
 from exovetter import const
@@ -29,11 +29,12 @@ def test_one_lpp():
     q = 4
 
     # Generic function that runs lightkurve and returns a lightkurve object
-    lcf = search_lightcurvefile(
-        target_name, quarter=q, mission=mission).download()
-    lc = lcf.SAP_FLUX.remove_nans().remove_outliers()
+    lcf = search_lightcurve(
+        target_name, quarter=q, mission=mission, exptime=1800).download(
+            flux_column="sap_flux")
+    lc = lcf.remove_nans().remove_outliers()
     flat = lc.flatten(window_length=81)
-    flat.flux = flat.flux - 1.0
+    flat.flux = flat.flux.value - 1.0
 
     # Use default .mat file from SourceForge
     lpp = vetters.Lpp(lc_name="flux", map_filename=None)
diff --git a/tests/test_sweet.py b/tests/test_sweet.py
index 80e43e4..4869b25 100644
--- a/tests/test_sweet.py
+++ b/tests/test_sweet.py
@@ -1,9 +1,9 @@
+import lightkurve
 import numpy as np
 import pytest
 from astropy import units as u
 from astropy.utils.data import download_file
 from lightkurve import LightCurve
-from lightkurve.search import open as lc_read  # Will be read in 2.x
 from numpy.testing import assert_allclose
 
 from exovetter import const as exo_const
@@ -28,8 +28,7 @@ def test_kplr10417986():
               duration=duration, depth=0 * exo_const.frac_amp,
               target_name=target_name, event_name=event_name)
 
-    lcf = lc_read(filename)
-    lc = lcf.PDCSAP_FLUX
+    lc = lightkurve.read(filename, flux_column="pdcsap_flux")
     sweet_vetter = Sweet()
     res = sweet_vetter.run(tce, lc)
     amp = res['amp']
@@ -56,7 +55,7 @@ def test_sweet_vetter():
     rng = np.random.default_rng(seed=1234)
     time = np.arange(1000)
     flux = 10 + rng.standard_normal(1000)
-    lc = LightCurve(time, flux, time_format='bkjd')
+    lc = LightCurve(time=time, flux=flux, time_format='bkjd')
 
     sweet_vetter = Sweet()
     res = sweet_vetter.run(tce, lc)