Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: testing standards #130

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
MAINT: remove nose syntax
  • Loading branch information
jklenzing committed Oct 3, 2023
commit 528f4ec8547a58c15addffe418ee9091dfb80d53
8 changes: 4 additions & 4 deletions pysatModels/tests/test_methods_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
class TestMethodsGeneralLogging(object):
"""Unit tests for log messages raised by general methods."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment."""
self.ch = logging.StreamHandler()
self.ch.setLevel(logging.INFO)
self.model = pysat.Instrument("pysat", "testmodel")

return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment."""

del self.ch, self.model
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_general_clean(self, caplog):
class TestMethodsGeneralDownload(object):
"""Unit tests for general methods handling downloads."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment."""
# TODO(#100): remove if-statement when it is always triggered
tkwargs = {}
Expand All @@ -65,7 +65,7 @@ def setup(self):

return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment."""

if os.path.isfile(self.out_file):
Expand Down
8 changes: 4 additions & 4 deletions pysatModels/tests/test_utils_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def eval_xarray_output(inst, xdata):
class TestUtilsConvertLoadModelXarray(object):
"""Unit tests for `utils.convert.load_model_xarray`."""

def setup(self):
def setup_method(self):
"""Create a clean testing setup before each method."""
self.ftime = pysat.instruments.pysat_testing_xarray._test_dates['']['']
self.filename = "%Y-%m-%d.nofile"
Expand All @@ -76,7 +76,7 @@ def setup(self):
self.xout = None
self.temp_file = 'None'

def teardown(self):
def teardown_method(self):
"""Clean up test environment after each method."""
if os.path.isfile(self.temp_file):
os.remove(self.temp_file)
Expand Down Expand Up @@ -130,11 +130,11 @@ def test_load_inst(self, mkey, mval):
class TestUtilsConvertPysatXarray(object):
"""Unit tests for utils.convert.convert_pysat_to_xarray."""

def setup(self):
def setup_method(self):
"""Create a clean testing setup before each method."""
self.ref_time = pysat.instruments.pysat_testing._test_dates['']['']

def teardown(self):
def teardown_method(self):
"""Clean up test environment after each method."""
del self.ref_time

Expand Down
36 changes: 18 additions & 18 deletions pysatModels/tests/test_utils_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class TestUtilsExtractInstThroughMod(object):
"""Unit tests for `instrument_view_through_model`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing')
Expand Down Expand Up @@ -51,7 +51,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out, self.input_kwargs
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_success_for_some_already_ran_data(self, caplog):
class TestUtilsExtractModObs(TestUtilsExtractInstThroughMod):
"""Unit tests for `utils.extract.extract_modelled_observations`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing')
Expand Down Expand Up @@ -233,7 +233,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out, self.input_kwargs
Expand Down Expand Up @@ -351,7 +351,7 @@ def test_success_for_some_already_ran_data(self, caplog):
class TestUtilsExtractModObsXarray(TestUtilsExtractModObs):
"""Xarray unit tests for `utils.extract.extract_modelled_observations`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing_xarray')
Expand Down Expand Up @@ -379,7 +379,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out, self.input_kwargs
Expand All @@ -393,7 +393,7 @@ def teardown(self):
class TestUtilsExtractModObsXarray2D(TestUtilsExtractModObs):
"""Xarray unit tests for `utils.extract.extract_modelled_observations`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray')
Expand Down Expand Up @@ -421,7 +421,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out, self.input_kwargs
Expand All @@ -431,7 +431,7 @@ def teardown(self):
class TestUtilsExtractInstModViewXarray(TestUtilsExtractInstThroughMod):
"""Xarray unit tests for `instrument_view_through_model`."""

def setup(self):
def setup_method(self):
"""Run before every method to create a clean testing setup."""

self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray')
Expand Down Expand Up @@ -464,7 +464,7 @@ def setup(self):

return

def teardown(self):
def teardown_method(self):
"""Run after every method to clean up previous testing."""

del self.inst, self.model, self.input_args, self.out, self.input_kwargs
Expand All @@ -482,7 +482,7 @@ def teardown(self):
class TestUtilsAltitudePressure(object):
"""Unit tests for `utils.extract.instrument_altitude_to_model_pressure`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing')
Expand All @@ -509,7 +509,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out
Expand Down Expand Up @@ -618,7 +618,7 @@ def test_alternate_output_names(self):
class TestUtilsAltitudePressureXarray(TestUtilsAltitudePressure):
"""Xarray unit tests for `instrument_altitude_to_model_pressure`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray')
Expand All @@ -645,7 +645,7 @@ def setup(self):
self.out = []
return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.inst, self.model, self.input_args, self.out
Expand All @@ -660,7 +660,7 @@ def teardown(self):
class TestUtilsExtractInstModIrregView(object):
"""Unit tests for `utils.extract.instrument_view_irregular_model`."""

def setup(self):
def setup_method(self):
"""Run before every method to create a clean testing setup."""

self.inst = pysat.Instrument(platform='pysat', name='testing',
Expand Down Expand Up @@ -689,7 +689,7 @@ def setup(self):

return

def teardown(self):
def teardown_method(self):
"""Run after every method to clean up previous testing."""

del self.inst, self.model, self.input_args, self.out, self.in_kwargs
Expand Down Expand Up @@ -773,7 +773,7 @@ def test_bad_kwarg_input(self, bad_key, bad_val, err_msg):
class TestUtilsExtractInstModIrregViewXarray(TestUtilsExtractInstModIrregView):
"""Xarray unit tests for `instrument_view_irregular_model`."""

def setup(self):
def setup_method(self):
"""Run before every method to create a clean testing setup."""

self.inst = pysat.Instrument(platform='pysat', name='testing2d_xarray',
Expand Down Expand Up @@ -802,7 +802,7 @@ def setup(self):

return

def teardown(self):
def teardown_method(self):
"""Run after every method to clean up previous testing."""

del self.inst, self.model, self.input_args, self.out, self.in_kwargs
Expand Down
6 changes: 3 additions & 3 deletions pysatModels/tests/test_utils_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class TestUtilsCompareModName(object):
"""Unit tests for `compare_mod_name_coordinates`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.model = pysat.Instrument(inst_module=pysat_testmodel, tag='')
Expand All @@ -33,7 +33,7 @@ def setup(self):

return

def teardown(self):
def teardown_method(self):
"""Clean up the unit test environment after each method."""

del self.model
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_compare_model_name_coordinates_failure(self, var, coords, msg,
class TestUtilsCompareModNamePressure(TestUtilsCompareModName):
"""Unit tests for `compare_mod_name_coordinates`."""

def setup(self):
def setup_method(self):
"""Set up the unit test environment for each method."""

self.model = pysat.Instrument(inst_module=pysat_testmodel,
Expand Down
Loading